Skip to content

Commit 58352f2

Browse files
committed
PR feedback: return validation error as early as possible
1 parent 8c7bf93 commit 58352f2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sql/rowexec/ddl_iters.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,8 +1876,12 @@ func (b *BaseBuilder) executeDropCheck(ctx *sql.Context, n *plan.DropCheck) erro
18761876
}
18771877
}
18781878

1879-
if !exists && n.IfExists {
1880-
return nil
1879+
if !exists {
1880+
if n.IfExists {
1881+
return nil
1882+
} else {
1883+
return fmt.Errorf("check '%s' was not found on the table", n.Name)
1884+
}
18811885
}
18821886

18831887
return chAlterable.DropCheck(ctx, n.Name)

0 commit comments

Comments
 (0)