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

JSON_TABLE: Unexpected ER_MIX_OF_GROUP_FUNC_AND_FIELDS upon query with JOIN

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 10.6.0
    • JSON, Optimizer
    • None

    Description

      SET sql_mode='ONLY_FULL_GROUP_BY';
      CREATE TABLE t (a TEXT);
      INSERT INTO t VALUES ('{}'),('[]');
      SELECT SUM(o) FROM t JOIN JSON_TABLE(t.a, '$' COLUMNS(o FOR ORDINALITY)) jt;
       
      # Cleanup
      DROP TABLE t;
      

      bb-10.6-mdev17399-hf 160bd1691

      MariaDB [test]> SELECT SUM(o) FROM t JOIN JSON_TABLE(t.a, '$' COLUMNS(o FOR ORDINALITY)) jt;
      ERROR 1140 (42000): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
      

      Works on MySQL:

      MySQL 8.0.23

      MySQL [test]> SELECT SUM(o) FROM t JOIN JSON_TABLE(t.a, '$' COLUMNS(o FOR ORDINALITY)) jt;
      +--------+
      | SUM(o) |
      +--------+
      |      2 |
      +--------+
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.