-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Cast(unsigned arg as decimal)
doesn't work properly
#7778
Comments
drop table t;
create table t(a bigint unsigned);
insert into t values(18446744073709551615); TiDB(localhost:4000) > select cast(a as decimal) from t;
+--------------------+
| cast(a as decimal) |
+--------------------+
| -1 |
+--------------------+
1 row in set (0.00 sec) |
@AndrewDi |
You are right, but I think there are two problems here: tidb/expression/builtin_cast.go Lines 483 to 501 in eb0c663
|
@AndrewDi So if the unsigned flag is not lost, the behavior will always be right. Add yes, a new function to handle unsigned should be a good idea. But it will be a lot of code change. So it may not be the best solution to this bug. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
or
return 18446744073709551615.
-1 returned.
tidb-server -V
or runselect tidb_version();
on TiDB)?master which commit is 5671382
The text was updated successfully, but these errors were encountered: