summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-06-29 20:06:28 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-06-29 20:06:28 +0530
commit7e19954b9af3f23903a512378d67d6c9b77ee670 (patch)
tree2a5587366b1f4f69de39de0a3198048cfa4c3170 /sql/item_jsonfunc.cc
parentc687afbbde4a0ed87fed2e2c8b446019662cc318 (diff)
downloadmariadb-git-7e19954b9af3f23903a512378d67d6c9b77ee670.tar.gz
MDEV-23029: JSON_OBJECTAGG returns NULL when used together with GROUP BY
Quick grouping is not supported for JSON_OBJECTAGG. The same for GROUP_CONCAT too so make sure that Item::quick_group is set to FALSE. We need to make sure that in the case of JSON_OBJECTAGG we don't create an index over grouping fields of the temp table and update the result after each iteration. Instead we should first sort the result in accordance to the GROUP BY fields and then perform the grouping and write the result to the temp table.
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index b9a84775311..fe3fae5840c 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -3725,6 +3725,7 @@ Item_func_json_objectagg::
Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item)
:Item_sum(thd, item)
{
+ quick_group= FALSE;
result.set_charset(collation.collation);
result.append("{");
}