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 from json opaque value to other types are not supported #37342

Closed
Tracked by #36993
YangKeao opened this issue Aug 24, 2022 · 1 comment
Closed
Tracked by #36993

Convert from json opaque value to other types are not supported #37342

YangKeao opened this issue Aug 24, 2022 · 1 comment
Labels
component/json type/enhancement The issue or PR belongs to an enhancement.

Comments

@YangKeao
Copy link
Member

YangKeao commented Aug 24, 2022

Enhancement

The following SQL will have different behavior for TiDB and MySQL:

select cast(cast(b'1011' as JSON) as UNSIGNED);

TiDB:

ERROR 1105 (HY000): Unknown type code in JSON

MySQL:

mysql> select cast(cast(X'01AF' as JSON) as SIGNED);
+---------------------------------------+
| cast(cast(X'01AF' as JSON) as SIGNED) |
+---------------------------------------+
|                                     0 |
+---------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------+
| Level   | Code | Message                                                                  |
+---------+------+--------------------------------------------------------------------------+
| Warning | 3156 | Invalid JSON value for CAST to INTEGER from column cast_as_json at row 1 |
+---------+------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)
@YangKeao YangKeao added the type/enhancement The issue or PR belongs to an enhancement. label Aug 24, 2022
@YangKeao YangKeao mentioned this issue Aug 24, 2022
34 tasks
@YangKeao
Copy link
Member Author

YangKeao commented Sep 2, 2022

Fixed, as we added opaque value support.

@YangKeao YangKeao closed this as completed Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/json type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants