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 is precision less than 0, it will be converted to decimal({},{})

What it means

When mapping a SeaTunnel DecimalType column back to the Postgres type converter, a precision of 0 or less is invalid for PostgreSQL NUMERIC, so the converter logs this warning and substitutes DEFAULT_PRECISION/DEFAULT_SCALE instead of failing. Subsequent writes use the substituted decimal definition, which may differ from the intended schema.

Source

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

                builder.dataType(PG_REAL);
                break;
            case DOUBLE:
                builder.columnType(PG_DOUBLE_PRECISION);
                builder.dataType(PG_DOUBLE_PRECISION);
                break;
            case DECIMAL:
                if (column.getSourceType() != null
                        && column.getSourceType().equalsIgnoreCase(PG_MONEY)) {
                    builder.columnType(PG_MONEY);
                    builder.dataType(PG_MONEY);
                } else {
                    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(),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set an explicit positive precision on the decimal column in the source/catalog (e.g. DECIMAL(10,2)).
  2. If precision is unknown, declare it in your SeaTunnel column definition before the Postgres sink.
  3. Confirm from the warning that the default decimal precision/scale is acceptable for your data.
  4. Adjust DEFAULT_PRECISION/DEFAULT_SCALE in PostgresTypeConverter if different defaults are needed.

Example fix

// before
catalogColumn = CatalogColumn.of("price", DecimalType(0, 0));
// after
catalogColumn = CatalogColumn.of("price", new DecimalType(10, 2));
Defensive patterns

Strategy: validation

Validate before calling

DecimalType dt = (DecimalType) col.getDataType();
if (dt.getPrecision() <= 0) {
    col = CatalogColumn.of(col.getName(), new DecimalType(10, 2), col.isNullable(), col.getDefaultValue());
}

Type guard

boolean isValidDecimal(CatalogColumn c) {
    return c.getDataType() instanceof DecimalType
        && ((DecimalType) c.getDataType()).getPrecision() > 0;
}

Prevention

When it happens

Trigger: PostgresTypeConverter.reconvert() on a CatalogColumn whose DecimalType has precision <= 0, typically when precision was never populated by the source.

Common situations: Sinks receiving catalog schemas built by custom/inferred sources where DECIMAL precision defaults to 0; programmatic column construction without explicit precision.

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/0bcf8ebc0d8c2506. Report an issue: GitHub.