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

Merged
merged 5 commits into from
May 20, 2020

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented May 15, 2020

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

@qw4990 qw4990 added type/bugfix This PR fixes a bug. sig/execution SIG execution needs-cherry-pick-4.0 labels May 15, 2020
@qw4990 qw4990 requested review from lysu, jackysp and wjhuang2016 May 15, 2020 09:14
@qw4990 qw4990 requested a review from a team as a code owner May 15, 2020 09:14
@ghost ghost requested review from wshwsh12 and removed request for a team May 15, 2020 09:14
@codecov
Copy link

codecov bot commented May 15, 2020

Codecov Report

Merging #17245 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #17245   +/-   ##
===========================================
  Coverage   80.1075%   80.1075%           
===========================================
  Files           511        511           
  Lines        139832     139832           
===========================================
  Hits         112016     112016           
  Misses        18864      18864           
  Partials       8952       8952           

@qw4990
Copy link
Contributor Author

qw4990 commented May 15, 2020

/rebuild

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

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

@lysu lysu added the status/LGT2 Indicates that a PR has LGTM 2. label May 20, 2020
@qw4990 qw4990 added status/can-merge Indicates a PR has been approved by a committer. and removed status/PTAL labels May 20, 2020
@lysu
Copy link
Contributor

lysu commented May 20, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented May 20, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented May 20, 2020

cherry pick to release-4.0 in PR #17306

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. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
4 participants