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

expression: fix type infer of unaryMinus which should return ETDecimal if ETInt overflow int (#11989) #11990

Merged
merged 2 commits into from
Sep 2, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Sep 2, 2019

cherry-pick #11989 to release-2.1


Signed-off-by: Lonng heng@lonng.org

What problem does this PR solve?

The typeInfer of unaryMinus function should return types.ETDecimal if the inferred type is types.ETInt and the value will overflow the int bound.

mysql> create table f (a decimal(65, 0));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into f value (-17000000000000000000);
ERROR 1264 (22003): Out of range value for column 'a' at row 1

What is changed and how it works?

Relax restrictions of the unaryMinus.typeInfer which should alway handle int overflow instead of just in SELECT statement.

Check List

Tests

  • Unit test
  • Integration test

Related changes

  • Need to update the tidb-ansible repository

Release note

  • Fix type infers of unaryMinus which should return ETDecimal if the ETInt overflow int bound.

…l if overflow int

Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 2, 2019

/run-all-tests

Copy link
Contributor

@crazycs520 crazycs520 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

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao winkyao added the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 2, 2019

Your auto merge job has been accepted, waiting for #11973

@sre-bot
Copy link
Contributor Author

sre-bot commented Sep 2, 2019

/run-all-tests

@sre-bot sre-bot merged commit 1e28af7 into pingcap:release-2.1 Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants