@@ -1065,7 +1065,11 @@ func (b *Builder) buildAlterAutoIncrement(inScope *scope, ddl *ast.DDL, table *p
10651065func (b * Builder ) buildAlterNotNull (inScope * scope , ddl * ast.DDL , table * plan.ResolvedTable ) (outScope * scope ) {
10661066 outScope = inScope
10671067 spec := ddl .NotNullSpec
1068- for _ , c := range table .Schema () {
1068+
1069+ // Resolve the schema defaults, so we don't leave around any UnresolvedColumnDefault expressions,
1070+ // otherwise Doltgres won't be able to process these nodes.
1071+ resolvedSchema := b .resolveSchemaDefaults (inScope , table .Schema ())
1072+ for _ , c := range resolvedSchema {
10691073 if strings .EqualFold (c .Name , spec .Column .String ()) {
10701074 colCopy := * c
10711075 switch strings .ToLower (spec .Action ) {
@@ -1093,7 +1097,11 @@ func (b *Builder) buildAlterNotNull(inScope *scope, ddl *ast.DDL, table *plan.Re
10931097func (b * Builder ) buildAlterChangeColumnType (inScope * scope , ddl * ast.DDL , table * plan.ResolvedTable ) (outScope * scope ) {
10941098 outScope = inScope
10951099 spec := ddl .ColumnTypeSpec
1096- for _ , c := range table .Schema () {
1100+
1101+ // Resolve the schema defaults, so we don't leave around any UnresolvedColumnDefault expressions,
1102+ // otherwise Doltgres won't be able to process these nodes.
1103+ resolvedSchema := b .resolveSchemaDefaults (inScope , table .Schema ())
1104+ for _ , c := range resolvedSchema {
10971105 if strings .EqualFold (c .Name , spec .Column .String ()) {
10981106 colCopy := * c
10991107 typ , err := types .ColumnTypeToType (& spec .Type )
0 commit comments