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

JSON_ARRAYAGG doesn't reject ORDER BY clause, but doesn't work either

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5.1
    • 10.5.4
    • JSON, Server
    • None

    Description

      The following query looks correct according to a standard SQL understanding of JSON_ARRAYAGG():

      select json_arrayagg(a order by a asc)
      from (select 1 a union select 2 a) t
      

      It doesn't get rejected by MariaDB 10.5.1's parser, but produces the wrong result

      [2,2]
      

      If this is not supported (it isn't according to the docs: https://mariadb.com/kb/en/json_arrayagg), then I would have expected a syntax error, instead of a wrong result.

      Attachments

        Issue Links

          Activity

            Why it should work BTW :\
            Fixing the ORDER BY to work properly here.

            holyfoot Alexey Botchkov added a comment - Why it should work BTW :\ Fixing the ORDER BY to work properly here.
            holyfoot Alexey Botchkov added a comment - https://github.com/MariaDB/server/commit/74198384e140bfffb2cbf139ec02e4c91747fab8

            People

              holyfoot Alexey Botchkov
              lukas.eder Lukas Eder
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.