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

The common type of bigint and bigint unsigned is not stable in TiDB #15771

Closed
windtalker opened this issue Mar 27, 2020 · 4 comments
Closed

The common type of bigint and bigint unsigned is not stable in TiDB #15771

windtalker opened this issue Mar 27, 2020 · 4 comments
Labels
component/expression severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@windtalker
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. What did you do?

mysql> create table test(id int, col_bigint bigint, col_unsigned_bigint bigint unsigned);                                                                                                Query OK, 0 rows affected (0.09 sec)

mysql> insert into test values(1,-1,18446744073709551614);                                                                                                                               Query OK, 1 row affected (0.01 sec)

mysql> select case when id = 1 then col_unsigned_bigint else col_bigint end c1 from  test;
+----------------------+
| c1                   |
+----------------------+
| 18446744073709551614 |
+----------------------+
1 row in set (0.01 sec)

mysql> select case when id = 2 then col_bigint else col_unsigned_bigint end c2 from  test;
+----+
| c2 |
+----+
| -2 |
+----+
1 row in set (0.00 sec)

2. What did you expect to see?

the above two sql should return the same result(The same query in Mysql-5.7 return -2)

3. What did you see instead?

the first one's return type is bigint unsigned, and the second one's return type is bigint

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

TiDB master

@rebelice
Copy link
Contributor

rebelice commented Nov 27, 2020

Both SQL will return the same result (18446744073709551614) on the master, related PR #21062 .
On the other hand, the above two SQL return the 18446744073709551614 in MySQL-8.0, so I think this issue has been resolved, and we should close it.

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@rebelice
Copy link
Contributor

close by #21062, cherry-pick release-4.0 PR is #21236

@rebelice
Copy link
Contributor

Please edit this comment to complete the following information

Bug

Note: Make Sure that 'component', and 'severity' labels are added

1. Root Cause Analysis (RCA)

Not process UnsignedFlag in AggFieldType

2. Symptom

Wrong result when using unsigned in AggField

3. All Trigger Conditions

  • using unsigned in AggField

4. Workaround (optional)

5. Affected versions

[v4.0.1:v4.0.8]

6. Fixed versions

v4.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants