{"record":{"id":"b0243784ce6e6f34","repo":"apache/seatunnel","slug":"the-timestamp-tz-column-type-datetimeoffset","errorCode":null,"errorMessage":"The timestamp_tz column {} type datetimeoffset({}) is out of range, which exceeds the maximum scale of {}, it will be converted to datetimeoffset({})","messagePattern":"The timestamp_tz column (.+?) type datetimeoffset\\((.+?)\\) is out of range, which exceeds the maximum scale of (.+?), it will be converted to datetimeoffset\\((.+?)\\)","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/sqlserver/SqlServerTypeConverter.java","lineNumber":490,"sourceCode":"                                column.getScale(),\n                                MAX_TIMESTAMP_SCALE,\n                                timestampScale);\n                    }\n                    builder.columnType(\n                            String.format(\"%s(%s)\", SQLSERVER_DATETIME2, timestampScale));\n                    builder.scale(timestampScale);\n                } else {\n                    builder.columnType(SQLSERVER_DATETIME2);\n                }\n                builder.dataType(SQLSERVER_DATETIME2);\n                break;\n            case TIMESTAMP_TZ:\n                // LTZ: maps to DATETIMEOFFSET\n                if (column.getScale() != null && column.getScale() > 0) {\n                    int timestampTzScale = column.getScale();\n                    if (timestampTzScale > MAX_TIMESTAMP_SCALE) {\n                        timestampTzScale = MAX_TIMESTAMP_SCALE;\n                        log.warn(\n                                \"The timestamp_tz column {} type datetimeoffset({}) is out of\"\n                                        + \" range, which exceeds the maximum scale of {}, \"\n                                        + \"it will be converted to datetimeoffset({})\",\n                                column.getName(),\n                                column.getScale(),\n                                MAX_TIMESTAMP_SCALE,\n                                timestampTzScale);\n                    }\n                    builder.columnType(\n                            String.format(\"%s(%s)\", SQLSERVER_DATETIMEOFFSET, timestampTzScale));\n                    builder.scale(timestampTzScale);\n                } else {\n                    builder.columnType(SQLSERVER_DATETIMEOFFSET);\n                }\n                builder.dataType(SQLSERVER_DATETIMEOFFSET);\n                break;\n            default:\n                throw CommonError.convertToConnectorTypeError(","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java#L472-L508","documentation":"A TIMESTAMP_TZ column (mapped to SQL Server DATETIMEOFFSET) has a scale above the maximum DATETIMEOFFSET precision (MAX_TIMESTAMP_SCALE, 7). reconvert clamps it and logs a warning that the stored type has reduced fractional precision.","triggerScenarios":"reconvert converts a TIMESTAMP_TZ column with scale > 7, e.g. from nanosecond-precision timezone-aware sources.","commonSituations":"Replicating timestamptz(9)-style columns from PostgreSQL or other engines into SQL Server DATETIMEOFFSET.","solutions":["Set the timestamp_tz column scale to <= 7 in the schema.","Drop extra precision upstream via a transform (truncate fractional seconds).","Accept the warning if 100ns precision is sufficient."],"exampleFix":"// before\nfield = { name = \"updated_at\", type = \"timestamp_tz(9)\" }\n// after\nfield = { name = \"updated_at\", type = \"timestamp_tz(7)\" }","handlingStrategy":"validation","validationCode":"if (tzScale > 7) log.warn(\"datetimeoffset scale {} exceeds max 7; will be clamped\", tzScale);","typeGuard":"boolean fitsSqlServerDatetimeOffset(Integer scale) { return scale == null || scale <= 7; }","tryCatchPattern":null,"preventionTips":["Limit timestamp_tz scale to 7 for SQL Server DATETIMEOFFSET targets","Truncate sub-100ns precision upstream","Validate timestamptz precision when migrating from PostgreSQL"],"tags":["jdbc","sqlserver","datetimeoffset","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-23T08:17:48.524Z"}