Skip to content

Commit df44c73

Browse files
authored
Merge pull request #2903 from dolthub/fulghum-0e77d549
[auto-bump] [no-release-notes] dependency by fulghum
2 parents 9a6edfc + 9b2c332 commit df44c73

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

enginetest/queries/alter_table_queries.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,22 @@ var AlterTableScripts = []ScriptTest{
513513
},
514514
},
515515
},
516+
{
517+
Name: "add column with inline check constraint definition",
518+
SetUpScript: []string{
519+
"create table t (pk int primary key);",
520+
},
521+
Assertions: []ScriptTestAssertion{
522+
{
523+
Query: "alter table t add column c int CONSTRAINT chk_c check(c > 10);",
524+
Expected: []sql.Row{{types.NewOkResult(0)}},
525+
},
526+
{
527+
Query: "insert into t values (1, 9);",
528+
ExpectedErrStr: `Check constraint "chk_c" violated`,
529+
},
530+
},
531+
},
516532
{
517533
Name: "multi-alter ddl column errors",
518534
SetUpScript: []string{

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/dolthub/go-icu-regex v0.0.0-20250319212010-451ea8d003fa
77
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
88
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
9-
github.com/dolthub/vitess v0.0.0-20250304211657-920ca9ec2b9a
9+
github.com/dolthub/vitess v0.0.0-20250320231804-0e77d549294c
1010
github.com/go-kit/kit v0.10.0
1111
github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d
1212
github.com/gocraft/dbr/v2 v2.7.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ github.com/dolthub/vitess v0.0.0-20250303224041-5cc89c183bc4 h1:wtS9ZWEyEeYzLCcq
6666
github.com/dolthub/vitess v0.0.0-20250303224041-5cc89c183bc4/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70=
6767
github.com/dolthub/vitess v0.0.0-20250304211657-920ca9ec2b9a h1:HIH9g4z+yXr4DIFyT6L5qOIEGJ1zVtlj6baPyHAG4Yw=
6868
github.com/dolthub/vitess v0.0.0-20250304211657-920ca9ec2b9a/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70=
69+
github.com/dolthub/vitess v0.0.0-20250320231804-0e77d549294c h1:Dv2DfEGb8WRBi8I5KF5Sy39TuZi/FI692mpobKWcv4g=
70+
github.com/dolthub/vitess v0.0.0-20250320231804-0e77d549294c/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70=
6971
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
7072
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
7173
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=

sql/planbuilder/ddl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ func (b *Builder) buildAlterTableClause(inScope *scope, ddl *ast.DDL) []*scope {
594594

595595
if ddl.ColumnAction != "" {
596596
columnActionOutscope := b.buildAlterTableColumnAction(tableScope, ddl, rt)
597-
outScopes = append(outScopes, columnActionOutscope)
597+
outScopes = append(outScopes, columnActionOutscope.copy())
598598

599599
if ddl.TableSpec != nil {
600600
if len(ddl.TableSpec.Columns) != 1 {

0 commit comments

Comments
 (0)