diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-29 20:06:28 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-29 20:06:28 +0530 |
commit | 7e19954b9af3f23903a512378d67d6c9b77ee670 (patch) | |
tree | 2a5587366b1f4f69de39de0a3198048cfa4c3170 /mysql-test/main/func_json.test | |
parent | c687afbbde4a0ed87fed2e2c8b446019662cc318 (diff) | |
download | mariadb-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 'mysql-test/main/func_json.test')
-rw-r--r-- | mysql-test/main/func_json.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 531f6cd758d..75a118a808f 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -827,6 +827,18 @@ select JSON_ARRAYAGG(col1) from t1; drop table t1; --echo # +--echo # MDEV-23029: JSON_OBJECTAGG returns NULL when used together with GROUP BY +--echo # + +CREATE TABLE t1 (e INT, a VARCHAR(255), v VARCHAR(255)); +INSERT INTO t1 VALUES (0, 'a1', '1') , (0, 'a2', '2') , (1, 'b1', '3'); + +EXPLAIN SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e; +SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e; + +DROP TABLE t1; + +--echo # --echo # End of 10.5 tests --echo # |