apache/seatunnel · warning

The time column {} type time({}) is out of range, which exce

Error message

The time column {} type time({}) is out of range, which exceeds the maximum scale of {}, it will be converted to time({})

What it means

Logged by PostgresTypeConverter.reconvert when a TIME column's fractional-second scale exceeds the maximum supported time scale. The scale is clamped to MAX_TIME_SCALE and extra precision is silently truncated.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeConverter.java:424

                    builder.dataType(PG_TEXT);
                } else if (column.getColumnLength() <= MAX_VARCHAR_LENGTH) {
                    builder.columnType(
                            String.format("%s(%s)", PG_VARCHAR, column.getColumnLength()));
                    builder.dataType(PG_VARCHAR);
                } else {
                    builder.columnType(PG_TEXT);
                    builder.dataType(PG_TEXT);
                }
                break;
            case DATE:
                builder.columnType(PG_DATE);
                builder.dataType(PG_DATE);
                break;
            case TIME:
                Integer timeScale = column.getScale();
                if (timeScale != null && timeScale > MAX_TIME_SCALE) {
                    timeScale = MAX_TIME_SCALE;
                    log.warn(
                            "The time column {} type time({}) is out of range, "
                                    + "which exceeds the maximum scale of {}, "
                                    + "it will be converted to time({})",
                            column.getName(),
                            column.getScale(),
                            MAX_SCALE,
                            timeScale);
                }
                if (timeScale != null && timeScale > 0) {
                    builder.columnType(String.format("%s(%s)", PG_TIME, timeScale));
                } else {
                    builder.columnType(PG_TIME);
                }
                builder.dataType(PG_TIME);
                builder.scale(timeScale);
                break;
            case TIMESTAMP:
                Integer timestampScale = column.getScale();

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Truncate the time column in source (e.g. CAST(col AS TIME(6)))
  2. Define the sink column as TIME without excess scale
  3. Accept sub-microsecond digits being dropped

Example fix

// before: TIME(9)
// after: CAST(col AS TIME(6))
Defensive patterns

Strategy: validation

Validate before calling

if (column.getScale() != null && column.getScale() > 6) { /* CAST source to TIME(6) */ }

Prevention

When it happens

Trigger: Sink TIME column with scale > MAX_TIME_SCALE (Postgres TIME supports up to 6 digits).

Common situations: Sources with nanosecond time (9 digits, e.g. MySQL TIME(6)/other engines) written to Postgres.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/b2d6df60487253be. Report an issue: GitHub.