Commit edc75c9c authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-11450 Assertion `!null_value' failed invirtual bool Item::send on json_search.

        Item_func_json_search::val_str didn't set the null_value
        properly. So that affected the next record in the resultset.
parent a8467e2f
......@@ -217,6 +217,15 @@ json_search(@j, 'all', '10', NULL, '$[*]')
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
json_search(@j, 'all', '10', NULL, '$[*][0].k')
"$[1][0].k"
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
json_search( json_col, 'all', 'foot' )
NULL
"$.c[1]"
drop table t1;
select json_unquote('"abc"');
json_unquote('"abc"')
abc
......
......@@ -92,6 +92,12 @@ select json_search(@j, 'all', 'abc', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$');
select json_search(@j, 'all', '10', NULL, '$[*]');
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
create table t1( json_col text );
insert into t1 values
('{ "a": "foobar" }'),
('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
select json_search( json_col, 'all', 'foot' ) from t1;
drop table t1;
select json_unquote('"abc"');
......
......@@ -1964,11 +1964,10 @@ String *Item_func_json_search::val_str(String *str)
goto error;
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto null_return;
}
if (args[n_arg]->null_value)
goto null_return;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......@@ -2063,6 +2062,7 @@ String *Item_func_json_search::val_str(String *str)
goto error;
}
null_value= 0;
return str;
......
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