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

overflow compability #3762

Closed
winkyao opened this issue Jul 14, 2017 · 1 comment
Closed

overflow compability #3762

winkyao opened this issue Jul 14, 2017 · 1 comment
Assignees

Comments

@winkyao
Copy link
Contributor

winkyao commented Jul 14, 2017

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

select -9223372036854775809;

  1. What did you expect to see?

9223372036854775809 is overflow math.MaxInt64, but mysql convert it to Decimal type.

mysql> select -9223372036854775809;
Field   1:  `-9223372036854775809`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     20
Max_length: 20
Decimals:   0
Flags:      NOT_NULL BINARY NUM


+----------------------+
| -9223372036854775809 |
+----------------------+
| -9223372036854775809 |
+----------------------+
1 row in set (0.00 sec)
  1. What did you see instead?

but TiDB return 9223372036854775807 caused by int overflow, and still use LONGLONG type;

mysql> select -9223372036854775809;
Field   1:  `-9223372036854775809`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     0
Max_length: 19
Decimals:   31
Flags:      BINARY NUM


+----------------------+
| -9223372036854775809 |
+----------------------+
|  9223372036854775807 |
+----------------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V)?
@winkyao
Copy link
Contributor Author

winkyao commented Jul 14, 2017

#3691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant