Skip to content

Commit

Permalink
Bumping to latest Vitess dev build from fulghum/alter-table-extension…
Browse files Browse the repository at this point in the history
…s branch
  • Loading branch information
fulghum committed Oct 2, 2024
1 parent 1c84e91 commit 5346e3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
github.com/dolthub/vitess v0.0.0-20240919225659-2ad81685e772
github.com/dolthub/vitess v0.0.0-20241001235747-8ed913ec76b7
github.com/go-kit/kit v0.10.0
github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d
github.com/gocraft/dbr/v2 v2.7.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
github.com/dolthub/vitess v0.0.0-20240919225659-2ad81685e772 h1:vDwBX7Lc8DnA8Zk0iRIu6slCw0GIUfYfFlYDYJQw8GQ=
github.com/dolthub/vitess v0.0.0-20240919225659-2ad81685e772/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
github.com/dolthub/vitess v0.0.0-20241001235747-8ed913ec76b7 h1:og740P9fUy1NzcmMhhAM/kTOFSjzy4ENzp6XUDc77uY=
github.com/dolthub/vitess v0.0.0-20241001235747-8ed913ec76b7/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
Expand Down
12 changes: 7 additions & 5 deletions sql/planbuilder/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,19 +937,20 @@ func (b *Builder) buildAlterNotNull(inScope *scope, ddl *ast.DDL, table *plan.Re
spec := ddl.NotNullSpec
for _, c := range table.Schema() {
if strings.EqualFold(c.Name, spec.Column.String()) {
colCopy := *c
switch strings.ToLower(spec.Action) {
case ast.SetStr:
// Set NOT NULL constraint
c.Nullable = false
colCopy.Nullable = false
case ast.DropStr:
// Drop NOT NULL constraint
c.Nullable = true
colCopy.Nullable = true
default:
err := sql.ErrUnsupportedFeature.New(ast.String(ddl))
b.handleErr(err)
}

modifyColumn := plan.NewModifyColumnResolved(table, c.Name, *c, nil)
modifyColumn := plan.NewModifyColumnResolved(table, c.Name, colCopy, nil)
outScope.node = b.modifySchemaTarget(inScope, modifyColumn, table.Schema())
return
}
Expand All @@ -964,13 +965,14 @@ func (b *Builder) buildAlterChangeColumnType(inScope *scope, ddl *ast.DDL, table
spec := ddl.ColumnTypeSpec
for _, c := range table.Schema() {
if strings.EqualFold(c.Name, spec.Column.String()) {
colCopy := *c
typ, err := types.ColumnTypeToType(&spec.Type)
if err != nil {
b.handleErr(err)
return
}
c.Type = typ
modifyColumn := plan.NewModifyColumnResolved(table, c.Name, *c, nil)
colCopy.Type = typ
modifyColumn := plan.NewModifyColumnResolved(table, c.Name, colCopy, nil)
outScope.node = b.modifySchemaTarget(inScope, modifyColumn, table.Schema())
return
}
Expand Down

0 comments on commit 5346e3d

Please sign in to comment.