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

handle unsigned value wrongly in builtinCastIntAsDecimalSig #11594

Closed
qw4990 opened this issue Aug 2, 2019 · 0 comments · Fixed by #11605
Closed

handle unsigned value wrongly in builtinCastIntAsDecimalSig #11594

qw4990 opened this issue Aug 2, 2019 · 0 comments · Fixed by #11605
Labels
type/bug The issue is confirmed as a bug.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Aug 2, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
CREATE TABLE t1 (v bigint(20) UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (1), (2);
SELECT SUM(IF(v > 1, v, -v)) FROM t1;
  1. What did you expect to see?
1
  1. What did you see instead?
+-----------------------+
| SUM(IF(v > 1, v, -v)) |
+-----------------------+
|  18446744073709551617 |
+-----------------------+
1 row in set (0.02 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
+---------------------------------------------+
| version()                                   |
+---------------------------------------------+
| 5.7.25-TiDB-v4.0.0-alpha-5-g1c43f55f9-dirty |
+---------------------------------------------+
1 row in set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
1 participant