apache/seatunnel · warning
The timestamp column {} type timestamp({}) is out of range,
Error message
The timestamp column {} type timestamp({}) is out of range, which exceeds the maximum scale of {}, it will be converted to timestamp({}) What it means
DB2 timestamps support a fractional-seconds precision up to 12 digits (MAX_TIMESTAMP_SCALE = 12). When reconvert finds a TIMESTAMP column whose scale exceeds 12, it clamps the scale to 12 and logs this warning, converting to timestamp(12). Extra nanosecond precision beyond 12 digits will be truncated.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java:398
builder.columnType(String.format("%s(%s)", DB2_CLOB, length));
builder.dataType(DB2_CLOB);
builder.length(length);
}
break;
case DATE:
builder.columnType(DB2_DATE);
builder.dataType(DB2_DATE);
break;
case TIME:
builder.columnType(DB2_TIME);
builder.dataType(DB2_TIME);
break;
case TIMESTAMP:
if (column.getScale() != null && column.getScale() > 0) {
int timestampScale = column.getScale();
if (column.getScale() > MAX_TIMESTAMP_SCALE) {
timestampScale = MAX_TIMESTAMP_SCALE;
log.warn(
"The timestamp column {} type timestamp({}) is out of range, "
+ "which exceeds the maximum scale of {}, "
+ "it will be converted to timestamp({})",
column.getName(),
column.getScale(),
MAX_TIMESTAMP_SCALE,
timestampScale);
}
builder.columnType(String.format("%s(%s)", DB2_TIMESTAMP, timestampScale));
builder.scale(timestampScale);
} else {
builder.columnType(DB2_TIMESTAMP);
}
builder.dataType(DB2_TIMESTAMP);
break;
default:
throw CommonError.convertToConnectorTypeError(
DatabaseIdentifier.DB_2,View on GitHub (pinned to cf67b549a7)
Solutions
- Reduce the source timestamp precision to <= 12 fractional digits
- Accept the clamped timestamp(12) if sub-12-digit truncation is acceptable
- Round timestamps in a transform before the sink to control truncation behavior
- Pick a sink database that supports the required precision if exactness matters
Example fix
// before TIMESTAMP(15) // after (DB2-compatible) TIMESTAMP(12)
Defensive patterns
Strategy: validation
Validate before calling
// before write
Integer scale = column.getScale();
if (scale != null && scale > 12) {
throw new IllegalArgumentException("Timestamp scale " + scale + " exceeds DB2 max 12 for column " + column.getName());
} Type guard
boolean fitsDb2Timestamp(Integer scale) {
return scale == null || scale <= 12;
} Prevention
- Limit timestamp fractional precision to 12 for DB2 sinks
- Round/normalize nanosecond timestamps before writing
- Check source timestamp precision during pipeline design, not at runtime
When it happens
Trigger: reconvert processes a column with SqlType.TIMESTAMP and a non-null scale > 12, e.g. sources with TIMESTAMP(13+) or nanosecond-precision types from other databases.
Common situations: Syncing nanosecond-precision timestamps (e.g. some Postgres/other engines or app-level types) into DB2; auto-generated schemas carrying source-native max precision; schema evolution copying precision verbatim.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- The decimal column {} type decimal({},{}) is out of range, w
- The timestamp column {} type timestamp({}) is out of range,
- The timestamp_tz column {} type datetime_tz({}) is out of ra
- The timestamp column {} type timestamp({}) is out of range,
- The timestamp column {} type timestamp({}) is out of range,
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/fa4e794a69c46f0b.
Report an issue: GitHub.