maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12262
Is it okay that JSON_OBJECTAGG creates objects with duplicate elements?
Hi Alexey,
Consider this example:
create table t20 (a varchar(10), b int);
insert into t20 values ('red', 1), ('blue', 2), ('red',1001), ('blue', 1002);
select json_objectagg(a,b) from t20;
+----------------------------------------------+
| json_objectagg(a,b) |
+----------------------------------------------+
| {"red":1, "blue":2, "red":1001, "blue":1002} |
+----------------------------------------------+
the created object has multiple members with the same name.
Is this expected or should be reported as a bug?
In MySQL-8, the above example produces this:
+-----------------------------+
| json_objectagg(a,b) |
+-----------------------------+
| {"red": 1001, "blue": 1002} |
+-----------------------------+
BR
Sergei
--
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog