-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
ddl: check if the column name already exists when we rename the column name #6284
Conversation
/run-all-test |
@@ -1350,6 +1350,14 @@ func (d *ddl) getModifiableColumnJob(ctx sessionctx.Context, ident ast.Ident, or | |||
if col == nil { | |||
return nil, infoschema.ErrColumnNotExists.GenByArgs(originalColName, ident.Name) | |||
} | |||
newColName := specNewColumn.Name.Name | |||
// If we want to rename the column name, we need to check whether it already exists. | |||
if newColName.L != originalColName.L { |
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.
Why we need to check it twice? Both in ddl_api.go and column.go .
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.
Because it is possible to have two identical rename operations in the DDL job list at the same time.
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.
So the go test coverage will cover the both?
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.
Added.
/run-all-tests |
LGTM |
PTAL @shenli |
LGTM |
If we want to rename the column name, we need to check whether it already exists.