Commit beded435 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-JSON_CONTAINS_PATH returns incorrect results and produces wrong warning.

        The Item_func_json_contains_path was mistakenly set with the
        no '*' paths limitation.
parent e5377be2
......@@ -176,6 +176,9 @@ NULL
select json_contains_path('{ "a": true }', 'all', NULL );
json_contains_path('{ "a": true }', 'all', NULL )
NULL
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*')
1
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
"asd"
......
......@@ -65,6 +65,7 @@ select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
select json_contains_path('{ "a": true }', NULL, '$.a' );
select json_contains_path('{ "a": true }', 'all', NULL );
select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
......
......@@ -1032,8 +1032,8 @@ longlong Item_func_json_contains_path::val_int()
{
String *s_p= args[n_arg]->val_str(tmp_paths+(n_arg-2));
if (s_p &&
path_setup_nwc(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
(const uchar *) s_p->ptr() + s_p->length()))
json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
(const uchar *) s_p->ptr() + s_p->length()))
{
report_path_error(s_p, &c_path->p, n_arg-2);
goto return_null;
......
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