[MDEV-22844] JSON_ARRAYAGG is limited by group_concat_max_len Created: 2020-06-09  Updated: 2020-06-15  Resolved: 2020-06-15

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.5
Fix Version/s: 10.5.4

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

set group_concat_max_len=64;
create table t30 (a varchar(254));
insert into t30 values (concat('x64-', repeat('a', 60)));
insert into t30 values (concat('x64-', repeat('b', 60)));                                                                                              
insert into t30 values (concat('x64-', repeat('c', 60)));

MariaDB [test]> select json_arrayagg(a) from t30;                                                                                                                      
+--------------------------------------------------------------------+                                                                                                 
| json_arrayagg(a)                                                   |                                                                                                 
+--------------------------------------------------------------------+                                                                                                 
| ["x64-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] |
+--------------------------------------------------------------------+
1 row in set, 1 warning (0.002 sec)

MariaDB [test]> show warnings;
+---------+------+---------------------------------+
| Level   | Code | Message                         |
+---------+------+---------------------------------+
| Warning | 1260 | Row 1 was cut by GROUP_CONCAT() |
+---------+------+---------------------------------+

This is bad on multiple levels:

  • Invalid JSON is produced (which may prevent the user application from processing it altogether)
  • The error message mentions GROUP_CONCAT, not json_arrayagg.


 Comments   
Comment by Sergei Petrunia [ 2020-06-09 ]

By default, 10.5 has

+----------------------+---------+
| Variable_name        | Value   |
+----------------------+---------+
| group_concat_max_len | 1048576 |
+----------------------+---------+

Comment by Alexey Botchkov [ 2020-06-15 ]

https://github.com/MariaDB/server/commit/6c573a9146caa76807db1190e0747f5befb5b170

Generated at Thu Feb 08 09:17:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.