{"record":{"id":"4818d0e9c9ac2693","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-4818d0","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which exceeds the maximum precision of {}, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which exceeds the maximum precision of (.+?), 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/db2/DB2TypeConverter.java","lineNumber":282,"sourceCode":"                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(),\n                            MAX_PRECISION,\n                            precision,\n                            scale);\n                }\n                if (scale < 0) {\n                    scale = 0;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which is scale less than 0, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java#L264-L300","documentation":"DB2 supports a maximum decimal precision of 31 (MAX_PRECISION). When reconvert sees a DecimalType whose precision exceeds 31, it clamps precision to 31 and shrinks the scale by the same overshoot (never below 0), logging this warning. Data with more significant digits than the converted type allows may lose precision or fail at write time.","triggerScenarios":"reconvert receives a column with e.g. decimal(38,10) — common from sources like MySQL DECIMAL(65,x) or user schemas with precision > 31.","commonSituations":"Syncing MySQL/Postgres NUMERIC(38+) columns into DB2; aggregations upstream that widen decimals; schema evolution carrying large precisions from source DDL.","solutions":["Reduce the source decimal precision to <= 31 (e.g. DECIMAL(31,8)) in the source DDL or schema transform","Cast/downscale the column in a SeaTunnel transform before the sink","Accept the clamped decimal(31,s) and verify application tolerance for reduced precision","Choose a sink connector/dialect whose precision limit matches the source"],"exampleFix":"// before\nDECIMAL(38, 10)\n// after (DB2-compatible)\nDECIMAL(31, 3)","handlingStrategy":"validation","validationCode":"// before write\nDecimalType dt = (DecimalType) column.getDataType();\nif (dt.getPrecision() > 31) {\n    // pre-cast/downscale: decimal(31, max(0, scale - (precision-31)))\n    throw new IllegalArgumentException(\"Precision \" + dt.getPrecision() + \" exceeds DB2 max 31 for column \" + column.getName());\n}","typeGuard":"boolean fitsDb2Decimal(DecimalType dt) {\n    return dt.getPrecision() > 0 && dt.getPrecision() <= 31;\n}","tryCatchPattern":null,"preventionTips":["Cap decimal precision at 31 when targeting DB2","Cast wide decimals (e.g. 38) in a transform before the sink","Document precision loss when downsizing for DB2","Compare source/sink precision limits when designing sync pipelines"],"tags":["jdbc","db2","decimal","precision"],"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"}