Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
-
None
Description
Hio,
MariaDB [(none)]> select json_extract('{"b":true}','$.b')=1; |
+------------------------------------+ |
| json_extract('{"b":true}','$.b')=1 | |
+------------------------------------+ |
| 1 |
|
+------------------------------------+ |
1 row in set (0.00 sec) |
|
MariaDB [test]> select json_value('{"b":true}','$.b')=1; |
+----------------------------------+ |
| json_value('{"b":true}','$.b')=1 | |
+----------------------------------+ |
| 0 |
|
+----------------------------------+ |
1 row in set, 1 warning (0.00 sec) |
|
MariaDB [(none)]> show warnings;
|
+---------+------+------------------------------------------+ |
| Level | Code | Message | |
+---------+------+------------------------------------------+ |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'true' | |
+---------+------+------------------------------------------+ |
1 row in set (0.00 sec) |
|
But this works
MariaDB [(none)]> select json_value('{"b":"true"}','$.b')='true'; |
+-----------------------------------------+ |
| json_value('{"b":"true"}','$.b')='true' | |
+-----------------------------------------+ |
| 1 |
|
+-----------------------------------------+ |
1 row in set (0.00 sec) |
|
MariaDB [(none)]> select json_value('{"b":true}','$.b')='true'; |
+---------------------------------------+ |
| json_value('{"b":true}','$.b')='true' | |
+---------------------------------------+ |
| 1 |
|
+---------------------------------------+ |
1 row in set (0.00 sec) |
Attachments
Issue Links
- relates to
-
MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
- Closed