Skip to content

Commit 7792628

Browse files
vuvovadr-m
authored andcommitted
MDEV-23004 When using GROUP BY with JSON_ARRAYAGG with joint table, the square brackets are not included
make test results stable followup for 98c7916
1 parent 8c029d4 commit 7792628

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mysql-test/main/func_json.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ CREATE TABLE t1(id int primary key, name varchar(50));
13721372
CREATE TABLE t2(id int, owner_id int);
13731373
INSERT INTO t1 VALUES (1, "name1"), (2, "name2"), (3, "name3");
13741374
INSERT INTO t2 VALUES (1, 1), (2, 1), (3, 2), (4, 3);
1375-
SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id)) as materials
1375+
SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id) ORDER BY t2.id) as materials
13761376
from t1 LEFT JOIN t2 on t1.id = t2.owner_id
13771377
GROUP BY t1.id ORDER BY id;
13781378
id materials

mysql-test/main/func_json.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ CREATE TABLE t2(id int, owner_id int);
866866
INSERT INTO t1 VALUES (1, "name1"), (2, "name2"), (3, "name3");
867867
INSERT INTO t2 VALUES (1, 1), (2, 1), (3, 2), (4, 3);
868868

869-
SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id)) as materials
869+
SELECT t1.id, JSON_ARRAYAGG(JSON_OBJECT('id',t2.id) ORDER BY t2.id) as materials
870870
from t1 LEFT JOIN t2 on t1.id = t2.owner_id
871871
GROUP BY t1.id ORDER BY id;
872872

0 commit comments

Comments
 (0)