mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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:
@ -217,6 +217,15 @@ json_search(@j, 'all', '10', NULL, '$[*]')
|
|||||||
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
|
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
|
||||||
json_search(@j, 'all', '10', NULL, '$[*][0].k')
|
json_search(@j, 'all', '10', NULL, '$[*][0].k')
|
||||||
"$[1][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"');
|
select json_unquote('"abc"');
|
||||||
json_unquote('"abc"')
|
json_unquote('"abc"')
|
||||||
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, '$[*]');
|
select json_search(@j, 'all', '10', NULL, '$[*]');
|
||||||
select json_search(@j, 'all', '10', NULL, '$[*][0].k');
|
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"');
|
select json_unquote('"abc"');
|
||||||
|
@ -1964,11 +1964,10 @@ String *Item_func_json_search::val_str(String *str)
|
|||||||
goto error;
|
goto error;
|
||||||
c_path->parsed= c_path->constant;
|
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(),
|
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
|
||||||
(const uchar *) js->ptr() + js->length());
|
(const uchar *) js->ptr() + js->length());
|
||||||
|
|
||||||
@ -2063,6 +2062,7 @@ end:
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
null_value= 0;
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user