-
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 string like '.1a1' to decimal has no warnings information #26004
Comments
what do you mean by |
Yes, this is only one bad cases, for more, you can see the description about the related PR |
Moreover, string to decimal also have the following problem compared to MySQL
warning information is
Warning info is inconsistent with MySQL
Warning info is somewhat Semi-finished products
The above SQL should have warning information |
mysql> select cast('1.4a' as decimal);
+-------------------------+
| cast('1.4a' as decimal) |
+-------------------------+
| 1 |
+-------------------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+-------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: '1.4a' |
+---------+------+-------------------------------------------+
1 row in set (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.23 |
+-----------+
1 row in set (0.00 sec)
mysql> select cast('' as decimal);
+---------------------+
| cast('' as decimal) |
+---------------------+
| 0 |
+---------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+---------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: '' |
+---------+------+---------------------------------------+
1 row in set (0.00 sec) Seems behavior changed. Which version of MySQL you use to test? Is there a source from MySQL document? |
The following is the result that executed locally
However, In MySQL 5.7 the result is quite different
|
So, I wander what version of MySQL should TiDB consistent with ?
Seems that 5.7 is the right version... |
AFAIK, we don't have a clear goal to be compatible with 5.7 or 8.0. Unless there is a strong reason, I think both are acceptable. I prefer intuitive behavior(like reporting |
But this issue is itself a compatible issue. If it is unclear which version to be compatible with, then the issue itself is unclear to stand or not. |
@tisonkun I think 5.7 maybe the right version that tidb should follower with. as there are big difference between version 5.7 and 8.x, what's your thought on this point? |
@yuqi1129 make sense. |
@tisonkun , Thanks your comment, i think the following point needs to be consistent with 5.7
This two problem may have higher priority, other problem can be ignored currently |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Run Master and execute
2. What did you expect to see? (Required)
MySQL
3. What did you see instead (Required)
TiDB
4. What is your TiDB version? (Required)
Master branch
The text was updated successfully, but these errors were encountered: