apache/seatunnel · warning

The decimal column {} type decimal({},{}) is out of range, w

Error message

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

What it means

This warning is logged by PostgresTypeConverter.reconvert when a DECIMAL column's precision exceeds Postgres' maximum precision (38). The converter automatically downgrades the precision (and reduces scale by the same amount) instead of failing the job. It indicates the catalog type will not round-trip exactly.

Source

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

                    DecimalType decimalType = (DecimalType) column.getDataType();
                    long precision = decimalType.getPrecision();
                    int scale = decimalType.getScale();
                    if (precision <= 0) {
                        precision = DEFAULT_PRECISION;
                        scale = DEFAULT_SCALE;
                        log.warn(
                                "The decimal column {} type decimal({},{}) is out of range, "
                                        + "which is precision less than 0, "
                                        + "it will be converted to decimal({},{})",
                                column.getName(),
                                decimalType.getPrecision(),
                                decimalType.getScale(),
                                precision,
                                scale);
                    } else if (precision > MAX_PRECISION) {
                        scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));
                        precision = MAX_PRECISION;
                        log.warn(
                                "The decimal column {} type decimal({},{}) is out of range, "
                                        + "which exceeds the maximum precision of {}, "
                                        + "it will be converted to decimal({},{})",
                                column.getName(),
                                decimalType.getPrecision(),
                                decimalType.getScale(),
                                MAX_PRECISION,
                                precision,
                                scale);
                    }
                    if (scale < 0) {
                        scale = 0;
                        log.warn(
                                "The decimal column {} type decimal({},{}) is out of range, "
                                        + "which is scale less than 0, "
                                        + "it will be converted to decimal({},{})",
                                column.getName(),
                                decimalType.getPrecision(),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Reduce source column precision to <= 38 before syncing
  2. Explicitly set a supported decimal(p,s) type in the sink schema
  3. Accept the automatic truncation if losing fractional digits is acceptable

Example fix

// before: catalog column DECIMAL(65,30)
// after: use DECIMAL(38,15) or cast in source query CAST(col AS DECIMAL(38,15))
Defensive patterns

Strategy: validation

Validate before calling

if (decimalType.getPrecision() > 38) { /* cast source column: CAST(col AS DECIMAL(38, s')) */ }

Prevention

When it happens

Trigger: Sink writes to Postgres a column declared DECIMAL(p,s) with p > 38 (MAX_PRECISION); reconvert() runs during catalog-to-Postgres type mapping.

Common situations: Copying tables from engines allowing huge precision (e.g. Hive/Oracle NUMBER, MySQL DECIMAL(65,x), Spark DECIMAL(38+)) into 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/f028171a8558c6cc. Report an issue: GitHub.