-
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
executor: fix the issue that UNIQUE constraint on boolean column results in an incorrect result in a comparison (#17245) #17306
Conversation
…lts in an incorrect result in a comparison (pingcap#17245)
/run-all-tests |
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
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
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
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
cherry-pick #17245 to release-4.0
What problem does this PR solve?
Issue Number: close tidb-challenge-program/bug-hunting-issue#49
Problem Summary: fix the issue that UNIQUE constraint on
boolean
column results in an incorrect result in comparison.What is changed and how it works?
The root cause is that if there is an index on the column
c1
, TiDB will generate apoint-get
plan for the querySELECT t0.c1 FROM t0 WHERE t0.c1=-129
.When encoding the index key from the value
-129
, an overflow error occurs since the range ofBOOL
values is[-128, 127]
, but TiDB ignore this error and convert it to-128
, and then we get an incorrect result.Check List
Tests
Release note