summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-06-30 01:03:49 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-07-02 16:23:48 +0300
commit779262842edf86c989c099c6930ae4683cbde609 (patch)
tree59505cdcb14aeb4b2ab2aab2b51db22bad4bc7f1
parent8c029d426a6592d6ce8f3704f78a97c8f8636a8b (diff)
downloadmariadb-git-779262842edf86c989c099c6930ae4683cbde609.tar.gz
MDEV-23004 When using GROUP BY with JSON_ARRAYAGG with joint table, the square brackets are not included
make test results stable followup for 98c7916f0f2
-rw-r--r--mysql-test/main/func_json.result2
-rw-r--r--mysql-test/main/func_json.test2
2 files changed, 2 insertions, 2 deletions
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 0c242a886b7..4ad7efea8af 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -1372,7 +1372,7 @@ CREATE TABLE t1(id int primary key, name varchar(50));
CREATE TABLE t2(id int, owner_id int);
INSERT INTO t1 VALUES (1, "name1"), (2, "name2"), (3, "name3");
INSERT INTO t2 VALUES (1, 1), (2, 1), (3, 2), (4, 3);
-SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id)) as materials
+SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id) ORDER BY t2.id) as materials
from t1 LEFT JOIN t2 on t1.id = t2.owner_id
GROUP BY t1.id ORDER BY id;
id materials
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index f08a72a5bce..d598809adf5 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -866,7 +866,7 @@ CREATE TABLE t2(id int, owner_id int);
INSERT INTO t1 VALUES (1, "name1"), (2, "name2"), (3, "name3");
INSERT INTO t2 VALUES (1, 1), (2, 1), (3, 2), (4, 3);
-SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id)) as materials
+SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id) ORDER BY t2.id) as materials
from t1 LEFT JOIN t2 on t1.id = t2.owner_id
GROUP BY t1.id ORDER BY id;