Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
-
None
-
10.2.10
Description
Example is for JSON_LENGTH, probably other functions are similarly affected, please keep them consistent.
JSON_LENGTH does some check on argument validity:
10.2 (OK) |
MariaDB [test]> select json_length('{{'); |
+-------------------+ |
| json_length('{{') | |
+-------------------+ |
| NULL | |
+-------------------+ |
1 row in set, 1 warning (0.00 sec) |
 |
MariaDB [test]> show warnings;
|
+---------+------+---------------------------------------------------------------------------------+ |
| Level | Code | Message | |
+---------+------+---------------------------------------------------------------------------------+ |
| Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_length' at position 2 | |
+---------+------+---------------------------------------------------------------------------------+ |
1 row in set (0.00 sec) |
But it does not notice obvious problems in the argument:
10.2 (not OK) |
MariaDB [test]> select json_length('{}{'); |
+--------------------+ |
| json_length('{}{') | |
+--------------------+ |
| 0 |
|
+--------------------+ |
1 row in set (0.00 sec) |
MySQL provides decent diagnostics:
MySQL 5.7 |
MySQL [test]> select json_length('{}{'); |
ERROR 3141 (22032): Invalid JSON text in argument 1 to function json_length: "The document root must not follow by other values." at position 2. |