1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on

JSON_REMOVE.

        null_value wasn't properly set in Item_json_func_remove::val_str.
This commit is contained in:
Alexey Botchkov
2017-03-20 15:18:06 +04:00
parent a06da5c848
commit 76f6c1e1ed
3 changed files with 24 additions and 0 deletions

View File

@ -618,3 +618,14 @@ connection default;
set @@global.max_allowed_packet = default; set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default; set @@global.net_buffer_length = default;
disconnect newconn; disconnect newconn;
create table t1(j longtext, p longtext);
insert into t1 values
('{"a":1,"b":2,"c":3}','$.a'),
('{"a":1,"b":2,"c":3}','$.b'),
('{"a":1,"b":2,"c":3}','$.c');
select j, p, json_remove(j, p) from t1;
j p json_remove(j, p)
{"a":1,"b":2,"c":3} $.a {"b": 2, "c": 3}
{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
drop table t1;

View File

@ -263,3 +263,14 @@ set @@global.max_allowed_packet = default;
set @@global.net_buffer_length = default; set @@global.net_buffer_length = default;
--disconnect newconn --disconnect newconn
#
# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE.
#
create table t1(j longtext, p longtext);
insert into t1 values
('{"a":1,"b":2,"c":3}','$.a'),
('{"a":1,"b":2,"c":3}','$.b'),
('{"a":1,"b":2,"c":3}','$.c');
select j, p, json_remove(j, p) from t1;
drop table t1;

View File

@ -2633,6 +2633,7 @@ v_found:
str->length(0); str->length(0);
if (append_simple(str, js->ptr(), rem_start - js->ptr()) || if (append_simple(str, js->ptr(), rem_start - js->ptr()) ||
(je.state == JST_KEY && n_item > 0 && str->append(",", 1)) ||
append_simple(str, rem_end, js->end() - rem_end)) append_simple(str, rem_end, js->end() - rem_end))
goto js_error; /* Out of memory. */ goto js_error; /* Out of memory. */
@ -2658,6 +2659,7 @@ v_found:
if (json_nice(&je, str, Item_func_json_format::LOOSE)) if (json_nice(&je, str, Item_func_json_format::LOOSE))
goto js_error; goto js_error;
null_value= 0;
return str; return str;
js_error: js_error: