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

Cannot convert JSON number to number #477

Closed
andremarianiello opened this issue Jun 22, 2021 · 1 comment
Closed

Cannot convert JSON number to number #477

andremarianiello opened this issue Jun 22, 2021 · 1 comment

Comments

@andremarianiello
Copy link

With MySQL

mysql> select JSON_EXTRACT('{"id":234}', '$.id')-1;
+--------------------------------------+
| JSON_EXTRACT('{"id":234}', '$.id')-1 |
+--------------------------------------+
|                                  233 |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> select JSON_EXTRACT('{"id":234}', '$.id') = 234;
+------------------------------------------+
| JSON_EXTRACT('{"id":234}', '$.id') = 234 |
+------------------------------------------+
|                                        1 |
+------------------------------------------+
1 row in set (0.00 sec)

With go-mysql-server

MySQL [(none)]> select JSON_EXTRACT('{"id":234}', '$.id')-1;
ERROR 1105 (HY000): unable to cast sql.JSONDocument{Val:234} of type sql.JSONDocument to float64
MySQL [(none)]> select JSON_EXTRACT('{"id":234}', '$.id') = 234;
+------------------------------------------+
| JSON_EXTRACT('{"id":234}', '$.id') = 234 |
+------------------------------------------+
|                                        0 |
+------------------------------------------+
1 row in set (0.002 sec)```
@zachmu
Copy link
Member

zachmu commented Jul 14, 2021

fixed by #503

@zachmu zachmu closed this as completed Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants