{"record":{"id":"093cb3ed01bf01a8","repo":"apache/seatunnel","slug":"skipping-unsupported-default-value-for-column-i-093cb3","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/sqlserver/SqlServerDialect.java","lineNumber":423,"sourceCode":"                                        .append(quoteIdentifier(constraintName));\n                        ddlSQL.add(dropConstraintSQL.toString());\n                    }\n                }\n\n                // Process column default\n                String defaultValueClause =\n                        sqlClauseWithDefaultValue(typeDefine, sourceDialectName);\n                if (StringUtils.isNotBlank(defaultValueClause)) {\n                    StringBuilder defaultSqlBuilder =\n                            buildAlterTablePrefix(tablePath)\n                                    .append(\" ADD \")\n                                    .append(defaultValueClause)\n                                    .append(\" FOR \")\n                                    .append(quoteIdentifier(column.getName()));\n                    ddlSQL.add(defaultSqlBuilder.toString());\n                }\n            } else {\n                log.warn(\n                        \"Skipping unsupported default value for column {} in table {}.\",\n                        column.getName(),\n                        tablePath.getFullName());\n            }\n        }\n\n        // Process column comment\n        if (column.getComment() != null) {\n            ddlSQL.add(buildColumnCommentSQL(tablePath, column));\n        }\n\n        // Build the SQL statement that modifies the column\n        StringBuilder sqlBuilder =\n                buildAlterTablePrefix(tablePath)\n                        .append(\" ALTER COLUMN \")\n                        .append(quoteIdentifier(column.getName()))\n                        .append(\" \")\n                        .append(columnType);","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerDialect.java#L405-L441","documentation":"During SQL Server schema-change (DDL) application, a column has a default value that the dialect cannot translate into a `ALTER TABLE ... ADD CONSTRAINT ... DEFAULT ... FOR <col>` clause, so the ADD-DEFAULT DDL is skipped and a warning is logged. The column is still created/modified; only its default value is not applied.","triggerScenarios":"Running schema evolution (applySchemaChange) on SQL Server when a CatalogColumn carries a defaultValue whose literal type or expression is not supported by SqlServerDialect's defaultValueClause builder (e.g. complex/function-based defaults, unsupported literal types).","commonSituations":"CDC/schema-evolution jobs syncing tables whose source columns have non-literal defaults (CURRENT_TIMESTAMP expressions, sequence defaults, bind variables); tables mirrored from other databases with exotic default expressions.","solutions":["Check the log to identify the column, then manually add the default in SQL Server: ALTER TABLE <t> ADD CONSTRAINT <c> DEFAULT <expr> FOR <col>.","Simplify the source column's default value to a plain literal that the dialect can render.","If the default is not needed for the sink, ignore the warning.","Upgrade/patch SqlServerDialect.defaultValueClause to support the missing default expression type."],"exampleFix":"// before (source column with unsupported default)\nColumn.of(\"created\", LocalDateTimeType()).withDefaultValue(...complex expression...)\n// after\nColumn.of(\"created\", LocalDateTimeType()).withDefaultValue(DefaultValue.of(null)) // or a literal; set the default manually in SQL Server","handlingStrategy":"validation","validationCode":"// Before running schema evolution, check every column's default value is a plain literal:\nboolean hasSupportedDefault(CatalogColumn c) {\n  return c.getDefaultValue() == null || c.getDefaultValue().getValue() instanceof Number\n      || c.getDefaultValue().getValue() instanceof String\n      || c.getDefaultValue().getValue() instanceof Boolean;\n}\ncolumns.stream().filter(c -> !hasSupportedDefault(c)).forEach(c -> log.warn(\"Manual default needed for \" + c.getName()));","typeGuard":"boolean isPlainLiteralDefault(Object v) { return v == null || v instanceof Number || v instanceof String || v instanceof Boolean; }","tryCatchPattern":null,"preventionTips":["Keep default values as simple literals in source schemas","Audit source tables for function/expression defaults before schema evolution","Plan to apply complex defaults manually post-migration"],"tags":["jdbc","sqlserver","schema-evolution","ddl"],"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"}