Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
Documentation for JSON_KEYS makes a distinction between "json_doc argument is not an object" (function should return NULL) and "JSON document is invalid" (function should return error). In reality, there seems to be no such difference, the function returns NULL either way:
MariaDB [test]> select json_valid('{"foo"}'), json_keys('{"foo"}'); |
+-----------------------+----------------------+ |
| json_valid('{"foo"}') | json_keys('{"foo"}') | |
+-----------------------+----------------------+ |
| 0 | NULL | |
+-----------------------+----------------------+ |
1 row in set, 1 warning (0.000 sec) |
|
MariaDB [test]> show warnings;
|
+---------+------+-------------------------------------------------------------------------------+ |
| Level | Code | Message | |
+---------+------+-------------------------------------------------------------------------------+ |
| Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_keys' at position 6 | |
+---------+------+-------------------------------------------------------------------------------+ |
1 row in set (0.000 sec) |
Maybe some other case of "JSON document is invalid" was meant, but there is no examples in the documentation or in the MTR test case.
Possibly it's just a documentation issue.