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

convert string to int return wrong result. #7398

Closed
crazycs520 opened this issue Aug 14, 2018 · 3 comments
Closed

convert string to int return wrong result. #7398

crazycs520 opened this issue Aug 14, 2018 · 3 comments
Labels
component/expression type/bug The issue is confirmed as a bug.

Comments

@crazycs520
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    In TiDB
mysql root@127.0.0.1:test> SELECT CAST('125e342.83' AS signed);
+------------------------------+
| CAST('125e342.83' AS signed) |
+------------------------------+
| -1                           |
+------------------------------+
1 row in set
Time: 0.006s
mysql root@127.0.0.1:test> SELECT CAST('125e342.83' AS signed);
+------------------------------+
| CAST('125e342.83' AS signed) |
+------------------------------+
| -1                           |
+------------------------------+
1 row in set
Time: 0.006s

In MySQL

mysql root@127.0.0.1:test> SELECT convert('125e342.83' , signed);
+--------------------------------+
| convert('125e342.83' , signed) |
+--------------------------------+
| 125                            |
+--------------------------------+
1 row in set
Time: 0.007s
mysql root@127.0.0.1:test> SELECT CAST('125e342.83' AS signed);
+------------------------------+
| CAST('125e342.83' AS signed) |
+------------------------------+
| 125                          |
+------------------------------+
@crazycs520 crazycs520 added the type/bug The issue is confirmed as a bug. label Aug 14, 2018
@zz-jason
Copy link
Member

nice catch! how did you find it?

@crazycs520
Copy link
Contributor Author

crazycs520 commented Aug 14, 2018

when I try to do this issue...#7390

@zz-jason
Copy link
Member

👍

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

No branches or pull requests

2 participants