Details
-
Bug
-
Status: In Progress (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.1
Description
Hi,
I found that when using dots and brackets in the key of the JSON data, use the path in JSON_VALUE will return NULL. There is an example:
SELECT 'dot_key' AS case_name, |
JSON_SEARCH('{"a.b":"x"}','one','x') AS path, |
JSON_VALUE('{"a.b":"x"}', |
JSON_UNQUOTE(JSON_SEARCH('{"a.b":"x"}','one','x'))) |
AS roundtrip_value; -- dot_key "$.a.b" NULL |
|
|
SELECT 'hyphen_key' AS case_name, |
JSON_SEARCH('{"a-b":"x"}','one','x') AS path, |
JSON_VALUE('{"a-b":"x"}', |
JSON_UNQUOTE(JSON_SEARCH('{"a-b":"x"}','one','x'))) |
AS roundtrip_value; -- hyphen_key "$.a-b" x |
|
|
SELECT 'bracket_key' AS case_name, |
JSON_SEARCH('{"a[0]":"x"}','one','x') AS path, |
JSON_VALUE('{"a[0]":"x"}', |
JSON_UNQUOTE(JSON_SEARCH('{"a[0]":"x"}','one','x'))) |
AS roundtrip_value; -- bracket_key "$.a[0]" NULL |
Attachments
Issue Links
- relates to
-
MDEV-21891 json_search returns incorrect result when keys contain dots
-
- Confirmed
-