Commit 4a484e7a authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in

json_find_path.

        The ..[0] path can be treated wrong on second json_find_path
        call.
parent 42ad4f28
...@@ -633,3 +633,6 @@ SET @str = 'bar', @path = '$'; ...@@ -633,3 +633,6 @@ SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path); SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path) JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
"$.foo" "$.foo"
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
bar
...@@ -281,3 +281,9 @@ drop table t1; ...@@ -281,3 +281,9 @@ drop table t1;
SET @str = 'bar', @path = '$'; SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path); SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
#
# MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path.
#
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
...@@ -1248,6 +1248,7 @@ static int handle_match(json_engine_t *je, json_path_t *p, ...@@ -1248,6 +1248,7 @@ static int handle_match(json_engine_t *je, json_path_t *p,
if (++next_step > p->last_step) if (++next_step > p->last_step)
{ {
je->s.c_str= je->value_begin; je->s.c_str= je->value_begin;
je->stack_p--;
return 1; return 1;
} }
} while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0); } while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0);
......
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