diff options
author | Sergei Golubchik <serg@mariadb.org> | 2023-01-17 10:58:00 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-05-02 14:24:06 +0200 |
commit | 837b926c0d91b3095dff5940e88336e3ba906dcf (patch) | |
tree | 2c67059ed30327a317d8a2aba902692120215ccb | |
parent | fe89df42686fd41e986dc775e12ad6f3594d5bca (diff) | |
download | mariadb-git-bb-10.6-serg.tar.gz |
MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECTbb-10.6-serg
add the test case
-rw-r--r-- | mysql-test/main/type_json.result | 18 | ||||
-rw-r--r-- | mysql-test/main/type_json.test | 14 |
2 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result index 681bd42c4e3..431a7f138f6 100644 --- a/mysql-test/main/type_json.result +++ b/mysql-test/main/type_json.result @@ -159,5 +159,23 @@ def j 250 (format=json) 9437283 16 Y 0 39 33 j {"a": {"b":"c"}} # +# MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +# +# maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +json_object('attr2',o) +{"attr2": [{"attr1": "root"}]} +drop table t1; +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +v1_json +{"a": "b"} +select json_arrayagg(v1_json) from v1; +json_arrayagg(v1_json) +[{"a": "b"}] +drop view v1; +# # End of 10.5 tests # diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 38754ba6e1e..8effe78f803 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -122,5 +122,19 @@ SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) A --enable_view_protocol --echo # +--echo # MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +--echo # +--echo # maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +drop table t1; + +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +select json_arrayagg(v1_json) from v1; +drop view v1; + +--echo # --echo # End of 10.5 tests --echo # |