-
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
planner: disallow multi-updates on primary key (#20603) #21113
planner: disallow multi-updates on primary key (#20603) #21113
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
/run-all-tests |
@dyzsr you're already a collaborator in bot's repo. |
/run-all-tests |
1 similar comment
/run-all-tests |
/run-all-tests |
/run-unit-test |
planner/core/logical_plan_builder.go
Outdated
if !flags[i] { | ||
continue | ||
} | ||
if col.IsPKHandleColumn(tbl.Meta()) || pkColumnsMap[content.TblID][col.ID] { |
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 constructing a temporary map pkColumnsMap
to check whether col
is primary key?
Could col.Primary
work the same way as pkColumnsMap[content.TblID][col.ID]
here?
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.
My mistake. Using mysql.HasPriKeyFlag
is enough, and I think #20603 should also change to this. Do I have to create another PR for it?
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, of course.
Don't hesitate to improve the code quality, even tiny changes.
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.
Sure, I've put this change into #20493. It may take longer time to review.
/run-all-tests |
/run-tics-test |
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.
LGTM
LGTM |
/merge |
Sorry @tiancaiamao, this branch cannot be merged without an approval of release maintainers |
/merge |
/run-all-tests |
/run-all-tests |
cherry-pick #20603 to release-4.0
What problem does this PR solve?
Issue Number: close #20594
Problem Summary:
MySQL doesn't allow multi-updates on primary key (i.e. updating primary key of the same table with different alias), but TiDB does.
What is changed and how it works?
Related changes
Check List
Tests
Side effects
Release note