Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22844

JSON_ARRAYAGG is limited by group_concat_max_len

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5
    • Fix Version/s: 10.5.4
    • Component/s: JSON
    • 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.

        Attachments

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            psergey Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: