{"record":{"id":"7f1c83bcbc5aac48","repo":"apache/seatunnel","slug":"the-scale-of-timestamp-type-is-larger-than-it","errorCode":null,"errorMessage":"The scale of timestamp type is larger than {}, it will be truncated to {}","messagePattern":"The scale of timestamp 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":270,"sourceCode":"                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                }\n                break;\n            case PG_TIMESTAMP_TZ:\n                // timestamptz -> TIMESTAMP_TZ\n                builder.dataType(LocalTimeType.OFFSET_DATE_TIME_TYPE);\n                if (typeDefine.getScale() != null && typeDefine.getScale() > MAX_TIMESTAMP_SCALE) {\n                    builder.scale(MAX_TIMESTAMP_SCALE);\n                } else {\n                    builder.scale(typeDefine.getScale());\n                }\n                break;\n            default:\n                if (typeDefine.getSqlType() == Types.OTHER) {","sourceCodeStart":252,"sourceCodeEnd":288,"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#L252-L288","documentation":"While converting a Postgres TIMESTAMP column (PG_TIMESTAMP) to a SeaTunnel type, a scale above MAX_TIMESTAMP_SCALE cannot be represented, so the converter logs this warning and truncates the scale to MAX_TIMESTAMP_SCALE rather than failing. Extra fractional-second digits are dropped.","triggerScenarios":"PostgresTypeConverter.convert() on a typeDefine for TIMESTAMP whose scale exceeds MAX_TIMESTAMP_SCALE (e.g. TIMESTAMP(6) microseconds from Postgres tables).","commonSituations":"Reading Postgres TIMESTAMP(6)/TIMESTAMP(p) columns where p exceeds the engine's timestamp scale; schema inference passing through the full precision.","solutions":["Cast the column in the source query, e.g. CAST(ts AS TIMESTAMP(3)).","Verify the truncated fractional precision meets your application's needs.","Declare the column scale explicitly in the catalog to stay within MAX_TIMESTAMP_SCALE.","Store the value as a string/epoch-nanos column if full precision must be preserved."],"exampleFix":"// before: SELECT ts FROM pg_table; -- TIMESTAMP(6)\n// after\nSELECT CAST(ts AS TIMESTAMP(3)) AS ts FROM pg_table;","handlingStrategy":"validation","validationCode":"Integer scale = typeDefine.getScale();\nif (scale != null && scale > maxTimestampScale) {\n    // cast in the source query instead: CAST(col AS TIMESTAMP(3))\n}","typeGuard":"boolean fitsPostgresTimestampScale(TypeDefine t) {\n    return t.getScale() == null || t.getScale() <= 3;\n}","tryCatchPattern":null,"preventionTips":["SELECT CAST(ts AS TIMESTAMP(3)) in source queries","Match engine timestamp scale limits in schema design","Store full-precision timestamps as epoch values when needed"],"tags":["jdbc","postgres","timestamp","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"}