{"record":{"id":"0bcf8ebc0d8c2506","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-0bcf8e","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which is precision less than 0, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which is precision less than 0, it will be converted to decimal\\((.+?),(.+?)\\)","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/psql/PostgresTypeConverter.java","lineNumber":345,"sourceCode":"                builder.dataType(PG_REAL);\n                break;\n            case DOUBLE:\n                builder.columnType(PG_DOUBLE_PRECISION);\n                builder.dataType(PG_DOUBLE_PRECISION);\n                break;\n            case DECIMAL:\n                if (column.getSourceType() != null\n                        && column.getSourceType().equalsIgnoreCase(PG_MONEY)) {\n                    builder.columnType(PG_MONEY);\n                    builder.dataType(PG_MONEY);\n                } else {\n                    DecimalType decimalType = (DecimalType) column.getDataType();\n                    long precision = decimalType.getPrecision();\n                    int scale = decimalType.getScale();\n                    if (precision <= 0) {\n                        precision = DEFAULT_PRECISION;\n                        scale = DEFAULT_SCALE;\n                        log.warn(\n                                \"The decimal column {} type decimal({},{}) is out of range, \"\n                                        + \"which is precision less than 0, \"\n                                        + \"it will be converted to decimal({},{})\",\n                                column.getName(),\n                                decimalType.getPrecision(),\n                                decimalType.getScale(),\n                                precision,\n                                scale);\n                    } else if (precision > MAX_PRECISION) {\n                        scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));\n                        precision = MAX_PRECISION;\n                        log.warn(\n                                \"The decimal column {} type decimal({},{}) is out of range, \"\n                                        + \"which exceeds the maximum precision of {}, \"\n                                        + \"it will be converted to decimal({},{})\",\n                                column.getName(),\n                                decimalType.getPrecision(),\n                                decimalType.getScale(),","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeConverter.java#L327-L363","documentation":"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.","triggerScenarios":"PostgresTypeConverter.reconvert() on a CatalogColumn whose DecimalType has precision <= 0, typically when precision was never populated by the source.","commonSituations":"Sinks receiving catalog schemas built by custom/inferred sources where DECIMAL precision defaults to 0; programmatic column construction without explicit precision.","solutions":["Set an explicit positive precision on the decimal column in the source/catalog (e.g. DECIMAL(10,2)).","If precision is unknown, declare it in your SeaTunnel column definition before the Postgres sink.","Confirm from the warning that the default decimal precision/scale is acceptable for your data.","Adjust DEFAULT_PRECISION/DEFAULT_SCALE in PostgresTypeConverter if different defaults are needed."],"exampleFix":"// before\ncatalogColumn = CatalogColumn.of(\"price\", DecimalType(0, 0));\n// after\ncatalogColumn = CatalogColumn.of(\"price\", new DecimalType(10, 2));","handlingStrategy":"validation","validationCode":"DecimalType dt = (DecimalType) col.getDataType();\nif (dt.getPrecision() <= 0) {\n    col = CatalogColumn.of(col.getName(), new DecimalType(10, 2), col.isNullable(), col.getDefaultValue());\n}","typeGuard":"boolean isValidDecimal(CatalogColumn c) {\n    return c.getDataType() instanceof DecimalType\n        && ((DecimalType) c.getDataType()).getPrecision() > 0;\n}","tryCatchPattern":null,"preventionTips":["Declare decimal precision explicitly in source catalogs","Never rely on inferred precision for numeric columns","Monitor conversion warnings during pipeline dry-runs"],"tags":["jdbc","postgres","decimal","precision","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-14T05:17:10.506Z"}