{"record":{"id":"e721266751bf63e0","repo":"apache/seatunnel","slug":"skipping-unsupported-default-value-for-column-i-e72126","errorCode":null,"errorMessage":"Skipping unsupported default value for column {} in table {}.","messagePattern":"Skipping unsupported default value for column (.+?) in table (.+?)\\.","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/PostgresDialect.java","lineNumber":402,"sourceCode":"                        .append(\"ALTER TABLE \")\n                        .append(tableIdentifier(tablePath))\n                        .append(\" ADD \")\n                        .append(quoteIdentifier(column.getName()))\n                        .append(\" \")\n                        .append(columnType);\n        if (column.getDefaultValue() == null) {\n            sqlBuilder.append(\" NULL\");\n        } else {\n            if (column.isNullable()) {\n                sqlBuilder.append(\" NULL\");\n            } else if (sameCatalog\n                    || !isSpecialDefaultValue(typeDefine.getDefaultValue(), sourceDialectName)) {\n                sqlBuilder\n                        .append(\" NOT NULL\")\n                        .append(\" \")\n                        .append(sqlClauseWithDefaultValue(typeDefine, sourceDialectName));\n            } else {\n                log.warn(\n                        \"Skipping unsupported default value for column {} in table {}.\",\n                        column.getName(),\n                        tablePath.getFullName());\n                sqlBuilder.append(\" NULL\");\n            }\n        }\n        return sqlBuilder.toString();\n    }\n\n    private List<String> buildUpdateColumnSQL(\n            Connection connection, TablePath tablePath, AlterTableModifyColumnEvent event)\n            throws SQLException {\n        List<String> ddlSQl = new ArrayList<>();\n        Column column = event.getColumn();\n        String sourceDialectName = event.getSourceDialectName();\n        boolean sameCatalog = StringUtils.equals(dialectName(), sourceDialectName);\n        BasicTypeDefine typeDefine = getTypeConverter().reconvert(column);\n        String columnType = sameCatalog ? column.getSourceType() : typeDefine.getColumnType();","sourceCodeStart":384,"sourceCodeEnd":420,"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/PostgresDialect.java#L384-L420","documentation":"When building ALTER TABLE ... ADD COLUMN SQL for Postgres, if a NOT NULL column has a default value that the connector cannot translate into the source dialect's SQL literal (isSpecialDefaultValue returns true and no mapping exists), it logs this warning and instead adds the column as NULL-able without the default. The schema change still proceeds but not exactly as requested.","triggerScenarios":"applySchemaChange -> buildAddColumnSQL with a column definition that is NOT NULL and whose defaultValue is classified as special/unsupported for sourceDialectName (e.g. complex expressions, function calls like CURRENT_TIMESTAMP variants, or dialect-specific literals).","commonSituations":"Schema-evolution sync between databases where the upstream default is an expression (e.g. NOW(), gen_random_uuid()) that the dialect translator does not map; cross-dialect auto schema evolution adding columns.","solutions":["Translate the default value manually: run the ALTER TABLE with the appropriate Postgres default expression yourself instead of relying on auto schema evolution.","Set the column to NULL-able in the schema change so the connector can add it cleanly, then apply the default separately.","Check isSpecialDefaultValue/sqlClauseWithDefaultValue support for your default literal, or contribute/extend the dialect mapping for it.","Avoid exotic default expressions on NOT NULL columns when synchronizing schema across dialects."],"exampleFix":"// before: default 'NOW()' treated as special, column added as NULL\nCatalogColumn.of(\"created_at\", TimestampType(), true, \"NOW()\");\n// after: apply default via explicit SQL or use a translatable literal\nCatalogColumn.of(\"created_at\", TimestampType(), false, null); // add column, then ALTER ... SET DEFAULT NOW()","handlingStrategy":"validation","validationCode":"String dv = typeDefine.getDefaultValue();\nif (typeDefine.isNotNull() && dv != null && isSpecialDefaultValue(dv, sourceDialectName)) {\n    // add column as NULL-able or run explicit ALTER TABLE with translated default\n}","typeGuard":"boolean hasTranslatableDefault(TypeDefine col, String dialect) {\n    String dv = col.getDefaultValue();\n    return dv == null || !isSpecialDefaultValue(dv, dialect);\n}","tryCatchPattern":"try {\n    applySchemaChange(change);\n} catch (SQLException e) {\n    log.warn(\"Schema change failed; check for columns skipped due to unsupported defaults\", e);\n}","preventionTips":["Avoid expression defaults (NOW(), gen_random_uuid()) on NOT NULL columns in auto schema evolution","Apply defaults with explicit ALTER TABLE statements post-migration","Verify dialect default-value mapping coverage before enabling schema evolution"],"tags":["jdbc","postgres","ddl","schema-evolution","default-value"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}