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

Squared brackets missing from JSON_ARRAYAGG when used in a view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5.1, 10.5
    • Fix Version/s: 10.5.4
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      Win 10

      Description

      When JSON_ARRAYAGG is used in a view, querying that view results in missing [ and ] brackets.

      create or replace view dummy as (
       
        select  json_arrayagg(json_object(
                 "type", "permPeriod",
                 "id", ID
               )) as JSON_DATA
        
        from TEST
       
        group by COL1
      )
       
      select * from dummy 
      

      gives:

      {"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8}
      

      instead of:

      [{"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8}]
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              fathert Tim Fathers
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: