{"record":{"id":"8aa48eae769ac718","repo":"apache/seatunnel","slug":"the-scale-of-time-type-is-larger-than-it-will","errorCode":null,"errorMessage":"The scale of time type is larger than {}, it will be truncated to {}","messagePattern":"The scale of time type is larger than (.+?), it will be truncated to (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeConverter.java","lineNumber":258,"sourceCode":"                builder.sourceType(pgDataType);\n                break;\n            case PG_CHAR_ARRAY:\n            case PG_VARCHAR_ARRAY:\n            case PG_TEXT_ARRAY:\n                builder.dataType(ArrayType.STRING_ARRAY_TYPE);\n                break;\n            case PG_BYTEA:\n                builder.dataType(PrimitiveByteArrayType.INSTANCE);\n                break;\n            case PG_DATE:\n                builder.dataType(LocalTimeType.LOCAL_DATE_TYPE);\n                break;\n            case PG_TIME:\n            case PG_TIME_TZ:\n                builder.dataType(LocalTimeType.LOCAL_TIME_TYPE);\n                if (typeDefine.getScale() != null && typeDefine.getScale() > MAX_TIME_SCALE) {\n                    builder.scale(MAX_TIME_SCALE);\n                    log.warn(\n                            \"The scale of time type is larger than {}, it will be truncated to {}\",\n                            MAX_TIME_SCALE,\n                            MAX_TIME_SCALE);\n                } else {\n                    builder.scale(typeDefine.getScale());\n                }\n                break;\n            case PG_TIMESTAMP:\n                builder.dataType(LocalTimeType.LOCAL_DATE_TIME_TYPE);\n                if (typeDefine.getScale() != null && typeDefine.getScale() > MAX_TIMESTAMP_SCALE) {\n                    builder.scale(MAX_TIMESTAMP_SCALE);\n                    log.warn(\n                            \"The scale of timestamp type is larger than {}, it will be truncated to {}\",\n                            MAX_TIMESTAMP_SCALE,\n                            MAX_TIMESTAMP_SCALE);\n                } else {\n                    builder.scale(typeDefine.getScale());\n                }","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeConverter.java#L240-L276","documentation":"While converting a Postgres TIME or TIME WITH TIME ZONE column (PG_TIME/PG_TIME_TZ) to a SeaTunnel type, a fractional-second scale above MAX_TIME_SCALE cannot be represented, so the converter logs this warning and truncates the scale to MAX_TIME_SCALE instead of failing.","triggerScenarios":"PostgresTypeConverter.convert() on a typeDefine for TIME/TIMETZ whose scale is greater than MAX_TIME_SCALE (e.g. TIME(6) microsecond precision from Postgres).","commonSituations":"Reading Postgres tables with high-precision TIME columns; catalog readers reporting fractional precision larger than the engine's supported time scale.","solutions":["Cast the column in your SQL/catalog query to a smaller scale, e.g. CAST(t AS TIME(3)).","Accept the truncation: verify your data does not need the dropped sub-second digits.","Set the column's scale explicitly in the source config/catalog so it stays within MAX_TIME_SCALE.","If microsecond precision is essential, use a string or timestamp representation instead."],"exampleFix":"// before: SELECT event_time FROM pg_table; -- TIME(6)\n// after\nSELECT CAST(event_time AS TIME(3)) AS event_time FROM pg_table;","handlingStrategy":"validation","validationCode":"Integer scale = typeDefine.getScale();\nif (scale != null && scale > maxTimeScale) {\n    // cast in the source query instead: CAST(col AS TIME(3))\n}","typeGuard":"boolean fitsPostgresTimeScale(TypeDefine t) {\n    return t.getScale() == null || t.getScale() <= 3;\n}","tryCatchPattern":null,"preventionTips":["SELECT CAST(time_col AS TIME(3)) in source queries","Check Postgres fractional precision before mapping to the engine","Use TIMESTAMP with known scale if sub-second data matters"],"tags":["jdbc","postgres","time","scale","type-conversion"],"backgroundTag":"value-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}