diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2020-06-04 10:00:56 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2020-06-04 10:00:56 +0400 |
commit | bb47050e1fdc49aa56fb55c8c55ff81ba24d355b (patch) | |
tree | 4b0e592a38460d12b4baf61f4203abe366e9cc27 /sql/item_sum.h | |
parent | e7bab059b764bc58ee14e182b51f90c47a6c8e17 (diff) | |
download | mariadb-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_sum.h')
-rw-r--r-- | sql/item_sum.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h index 7ff71c84209..7c69dea4a9a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1918,6 +1918,12 @@ protected: bool repack_tree(THD *thd); + /* + Says whether the function should skip NULL arguments + or add them to the result. + Redefined in JSON_ARRAYAGG. + */ + virtual bool skip_nulls() const { return true; } public: // Methods used by ColumnStore bool get_distinct() const { return distinct; } @@ -1947,7 +1953,7 @@ public: void clear(); bool add() { - return add(true); + return add(skip_nulls()); } void reset_field() { DBUG_ASSERT(0); } // not used void update_field() { DBUG_ASSERT(0); } // not used |