Commit 3557de68 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns

TRUE.

        Let's make empty brackets to be the syntax error in the JSON
        paths.
parent a3ba8c36
......@@ -720,3 +720,8 @@ json_data
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
json_data
{"user": "Jožko Mrkvičká"}
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
json_contains_path('{"foo":"bar"}', 'one', '$[]')
NULL
Warnings:
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
......@@ -370,3 +370,11 @@ select json_array(5,json_query('[1,2]','$'));
SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
#
# MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns TRUE.
#
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
......@@ -1043,7 +1043,7 @@ static int json_path_transitions[N_PATH_STATES][N_PATH_CLASSES]=
/* PT */ { PS_OK, JE_SYN, PS_AST, PS_AR, JE_SYN, PS_KEY, JE_SYN, JE_SYN,
JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
/* AR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, PS_PT, JE_SYN, PS_Z,
/* AR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, JE_SYN, JE_SYN, PS_Z,
PS_INT, JE_SYN, JE_SYN, PS_SAR, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
/* SAR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, PS_PT, JE_SYN, PS_Z,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment