-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto_inc,constraint: Ignore check constraint for auto-increment check #38966
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -675,6 +675,10 @@ func checkAutoIncrementOp(colDef *ast.ColumnDef, index int) (bool, error) { | |
|
||
func isConstraintKeyTp(constraints []*ast.Constraint, colDef *ast.ColumnDef) bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, can we change the name of this function(or some comments)? I am worrying that somebody will use this function for non-auto-incr columns. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It returns whether the column is a constraint key. I think it's fine to use it for other purpose, at least the change in this PR doesn't break it, because the |
||
for _, c := range constraints { | ||
// ignore constraint check | ||
if c.Tp == ast.ConstraintCheck { | ||
continue | ||
} | ||
if c.Keys[0].Expr != nil { | ||
continue | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this KEY needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The
AUTO_INCREMENT
column has to be defines as a key (any kind is fine).