-
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
Wrong Result in Cast Blob to Json #58959
Comments
I think the root cause already includes in warning message. In TiDB, we will cast the json result to double, then use the mysql> SELECT CAST(t0.c0 AS JSON) IS TRUE FROM t0;
+-----------------------------+
| CAST(t0.c0 AS JSON) IS TRUE |
+-----------------------------+
| 1 |
+-----------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 3986 | Evaluating a JSON value in SQL boolean context does an implicit comparison against JSON integer 0; if this is not what you want, consider converting JSON to a SQL numeric type with JSON_VALUE RETURNING |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec) |
Seems like in MySQL, when evaluated as a logical expression, a
And I can't find official document about this behavior of MySQL. In TiDB, when evaluated as a logical expression, a
This is a very corner usage so I'm setting severity to minor. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
see the following case:
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
TiDB v8.5.0
The text was updated successfully, but these errors were encountered: