mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-11473 JSON_REMOVE returns invalid results.
Item_func_json_remove::val_str fixed.
This commit is contained in:
@ -150,7 +150,7 @@ json_remove(@j, '$[0]')
|
||||
[ ["b", "c"], "d"]
|
||||
select json_remove(@j, '$[1]');
|
||||
json_remove(@j, '$[1]')
|
||||
["a" "d"]
|
||||
["a", "d"]
|
||||
select json_remove(@j, '$[2]');
|
||||
json_remove(@j, '$[2]')
|
||||
["a", ["b", "c"]]
|
||||
|
@ -1667,9 +1667,7 @@ String *Item_func_json_remove::val_str(String *str)
|
||||
rem_start= (const char *) (je.s.c_str - je.sav_c_len);
|
||||
json_string_set_str(&key_name, lp->key, lp->key_end);
|
||||
if (json_key_matches(&je, &key_name))
|
||||
{
|
||||
goto v_found;
|
||||
}
|
||||
|
||||
if (json_skip_key(&je))
|
||||
goto error;
|
||||
@ -1693,7 +1691,7 @@ v_found:
|
||||
if (json_skip_key(&je) || json_scan_next(&je))
|
||||
goto error;
|
||||
|
||||
rem_end= (je.state == JST_VALUE) ?
|
||||
rem_end= (je.state == JST_VALUE && n_item == 0) ?
|
||||
(const char *) je.s.c_str : (const char *) (je.s.c_str - je.sav_c_len);
|
||||
|
||||
str->length(0);
|
||||
|
Reference in New Issue
Block a user