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

Different result from Mysql when casting a type conversation from a long string to an integer. #11179

Closed
SunRunAway opened this issue Jul 10, 2019 · 1 comment
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!
Type conversation from a long string to integer.

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
SELECT '415290769594460e2e485922904f345d' ^ 1;
SELECT cast('415290769594460e2e485922904f345d' as UNSIGNED);
  1. What did you expect to see?

In MySQL,

mysql> SELECT '415290769594460e2e485922904f345d' ^ 1;
+----------------------------------------+
| '415290769594460e2e485922904f345d' ^ 1 |
+----------------------------------------+
|                        415290769594461 |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SELECT cast('415290769594460e2e485922904f345d' as UNSIGNED);
+------------------------------------------------------+
| cast('415290769594460e2e485922904f345d' as UNSIGNED) |
+------------------------------------------------------+
|                                      415290769594460 |
+------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
  1. What did you see instead?

In TiDB,

mysql> SELECT '415290769594460e2e485922904f345d' ^ 1;
+----------------------------------------+
| '415290769594460e2e485922904f345d' ^ 1 |
+----------------------------------------+
|                      41529076959446001 |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> SELECT cast('415290769594460e2e485922904f345d' as UNSIGNED);
+------------------------------------------------------+
| cast('415290769594460e2e485922904f345d' as UNSIGNED) |
+------------------------------------------------------+
|                                    41529076959446000 |
+------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    fdbc149
@SunRunAway SunRunAway added the type/bug The issue is confirmed as a bug. label Jul 10, 2019
@SunRunAway SunRunAway changed the title Type conversation from a long string to integer. Different result from Mysql when casting a type conversation from a long string to an integer. Jul 10, 2019
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@zz-jason
Copy link
Member

close due to fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants