1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Alexey Botchkov
2016-12-03 12:11:06 +04:00
parent a8467e2fab
commit edc75c9c16
3 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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"');

View File

@ -1964,10 +1964,9 @@ 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;
}
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
@ -2063,6 +2062,7 @@ end:
goto error;
}
null_value= 0;
return str;