| 1 |
########### suite/json/t/json_group_concat_innodb.test # |
| 2 |
# Tests group_concat json function using the innodb storage engine # |
| 3 |
# # |
| 4 |
# This test copies some tests originally in json.test # |
| 5 |
###################################################################### |
| 6 |
# Set the session storage engine |
| 7 |
set default_storage_engine=innodb; |
| 8 |
|
| 9 |
--source suite/json/inc/json_group_concat.inc |
| 10 |
|
| 11 |
create table t(j json, c varchar(20)) charset utf8mb4; |
| 12 |
show create table t; |
| 13 |
insert into t values (cast('[1,2,3]' as json), '[a,b,c]'); |
| 14 |
insert into t values (cast(7 as json), '7'), (cast(2 as json), '2'); |
| 15 |
insert into t values (cast(7 as json), '7'), (cast(2 as json), '2'); |
| 16 |
|
| 17 |
select group_concat(j), group_concat(distinct j), group_concat(c) from t; |
| 18 |
select group_concat(j order by j), group_concat(distinct j order by j), group_concat(c order by c) from t; |
| 19 |
insert into t values (NULL, NULL); |
| 20 |
|
| 21 |
select group_concat(j), group_concat(distinct j), group_concat(c) from t; |
| 22 |
|
| 23 |
--echo # |
| 24 |
--echo # Bug#22992666 NULL VALUE IN JSON COLUMN CORRUPTS GROUP_CONCAT |
| 25 |
--echo # WITH ORDER BY CLAUSE |
| 26 |
--echo # |
| 27 |
SELECT GROUP_CONCAT(j ORDER BY j) AS c1, |
| 28 |
GROUP_CONCAT(DISTINCT j ORDER BY j) AS c2, |
| 29 |
GROUP_CONCAT(c ORDER BY c) AS c3 |
| 30 |
FROM t; |
| 31 |
|
| 32 |
drop table t; |