Skip to content

Commit 71458fc

Browse files
author
James Cor
committed
fix
1 parent 8711499 commit 71458fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sql/plan/alter_check.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ func NewCheckDefinition(ctx *sql.Context, check *sql.CheckConstraint) (*sql.Chec
157157
unqualifiedCols, _, err := transform.Expr(check.Expr, func(e sql.Expression) (sql.Expression, transform.TreeIdentity, error) {
158158
gf, ok := e.(*expression.GetField)
159159
if ok {
160-
return expression.NewGetField(gf.Index(), gf.Type(), gf.Name(), gf.IsNullable()), transform.NewTree, nil
160+
newGf := expression.NewGetField(gf.Index(), gf.Type(), gf.Name(), gf.IsNullable())
161+
newGf = newGf.WithQuotedNames(sql.GlobalSchemaFormatter, true)
162+
return newGf, transform.NewTree, nil
161163
}
162164
return e, transform.SameTree, nil
163165
})
@@ -167,7 +169,7 @@ func NewCheckDefinition(ctx *sql.Context, check *sql.CheckConstraint) (*sql.Chec
167169

168170
return &sql.CheckDefinition{
169171
Name: check.Name,
170-
CheckExpression: fmt.Sprintf("%s", unqualifiedCols),
172+
CheckExpression: unqualifiedCols.String(),
171173
Enforced: check.Enforced,
172174
}, nil
173175
}

0 commit comments

Comments
 (0)