mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-22236 JSON_ARRAYAGG query leads to SIGSEGV in Charset::swap on optimized builds.
The json_arrayagg::val_str should handle NULL result.
This commit is contained in:
@ -1213,3 +1213,11 @@ DROP TABLE t1;
|
|||||||
#
|
#
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# MDEV-16620 JSON_ARRAYAGG
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
SELECT JSON_ARRAYAGG(a) FROM t1;
|
||||||
|
JSON_ARRAYAGG(a)
|
||||||
|
NULL
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -732,3 +732,11 @@ DROP TABLE t1;
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
-- echo #
|
||||||
|
-- echo # MDEV-16620 JSON_ARRAYAGG
|
||||||
|
-- echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
SELECT JSON_ARRAYAGG(a) FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -3632,13 +3632,14 @@ String* Item_func_json_arrayagg::convert_to_json(Item *item, String *res)
|
|||||||
|
|
||||||
String* Item_func_json_arrayagg::val_str(String *str)
|
String* Item_func_json_arrayagg::val_str(String *str)
|
||||||
{
|
{
|
||||||
str= Item_func_group_concat::val_str(str);
|
if ((str= Item_func_group_concat::val_str(str)))
|
||||||
|
{
|
||||||
String s;
|
String s;
|
||||||
s.append('[');
|
s.append('[');
|
||||||
s.swap(*str);
|
s.swap(*str);
|
||||||
str->append(s);
|
str->append(s);
|
||||||
str->append(']');
|
str->append(']');
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user