Skip to content
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

Merged
merged 1 commit into from
May 20, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented May 20, 2020

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 a point-get plan for the query SELECT t0.c1 FROM t0 WHERE t0.c1=-129.
When encoding the index key from the value -129, an overflow error occurs since the range of BOOL values is [-128, 127], but TiDB ignore this error and convert it to -128, and then we get an incorrect result.

Check List

Tests

  • Unit test

Release note

  • fix the issue that UNIQUE constraint on boolean column results in an incorrect result in a comparison

@sre-bot sre-bot requested a review from a team as a code owner May 20, 2020 05:57
@sre-bot
Copy link
Contributor Author

sre-bot commented May 20, 2020

/run-all-tests

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jebter
Copy link

jebter commented May 20, 2020

@zz-jason @jackysp PTAL

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jebter
Copy link

jebter commented May 20, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 20, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented May 20, 2020

Your auto merge job has been accepted, waiting for:

  • 17240

@sre-bot
Copy link
Contributor Author

sre-bot commented May 20, 2020

/run-all-tests

@sre-bot sre-bot merged commit 76c7eee into pingcap:release-4.0 May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants