summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-06-04 10:00:56 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2020-06-04 10:00:56 +0400
commitbb47050e1fdc49aa56fb55c8c55ff81ba24d355b (patch)
tree4b0e592a38460d12b4baf61f4203abe366e9cc27 /sql/item_jsonfunc.cc
parente7bab059b764bc58ee14e182b51f90c47a6c8e17 (diff)
downloadmariadb-git-bb47050e1fdc49aa56fb55c8c55ff81ba24d355b.tar.gz
MDEV-22640, MDEV-22449, MDEV-21528 JSON_ARRAYAGG crashes with NULL values.
We have to include NULL in the result which the GOUP_CONCAT doesn't always do. Also converting should be done into another String instance as these can be same.
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 134c2573ea7..45f57d99011 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -3621,12 +3621,12 @@ int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
}
-String* Item_func_json_arrayagg::convert_to_json(Item *item, String *res)
+String* Item_func_json_arrayagg::convert_to_json(Item *item)
{
String tmp;
- res->length(0);
- append_json_value(res, item, &tmp);
- return res;
+ m_tmp_json.length(0);
+ append_json_value(&m_tmp_json, item, &tmp);
+ return &m_tmp_json;
}