@@ -85,11 +85,10 @@ func (t *DDLTransform) Transform(tree *pg_query.ParseResult, result *Result) (bo
8585
8686 case * pg_query.Node_AlterTableStmt :
8787 if n .AlterTableStmt != nil {
88- // Check for ADD CONSTRAINT commands
88+ // Check for unsupported ALTER TABLE commands (constraints, NOT NULL, DEFAULT, etc.)
8989 for _ , cmd := range n .AlterTableStmt .Cmds {
9090 if alterCmd := cmd .GetAlterTableCmd (); alterCmd != nil {
91- // Check if this is adding a constraint
92- if t .isConstraintCommand (alterCmd ) {
91+ if t .isUnsupportedAlterCommand (alterCmd ) {
9392 result .IsNoOp = true
9493 result .NoOpTag = "ALTER TABLE"
9594 return true , nil
@@ -301,11 +300,20 @@ func (t *DDLTransform) isUnsupportedDefault(expr *pg_query.Node) bool {
301300 return true
302301}
303302
304- // isConstraintCommand checks if an ALTER TABLE command is adding a constraint
305- func (t * DDLTransform ) isConstraintCommand (cmd * pg_query.AlterTableCmd ) bool {
303+ // isUnsupportedAlterCommand checks if an ALTER TABLE command is unsupported by DuckLake
304+ func (t * DDLTransform ) isUnsupportedAlterCommand (cmd * pg_query.AlterTableCmd ) bool {
306305 switch cmd .Subtype {
306+ // Constraint commands
307307 case pg_query .AlterTableType_AT_AddConstraint ,
308- pg_query .AlterTableType_AT_ValidateConstraint :
308+ pg_query .AlterTableType_AT_ValidateConstraint ,
309+ pg_query .AlterTableType_AT_DropConstraint :
310+ return true
311+ // NOT NULL commands - DuckLake doesn't handle these well
312+ case pg_query .AlterTableType_AT_SetNotNull ,
313+ pg_query .AlterTableType_AT_DropNotNull :
314+ return true
315+ // DEFAULT commands - DuckLake has limited support
316+ case pg_query .AlterTableType_AT_ColumnDefault :
309317 return true
310318 }
311319 return false
0 commit comments