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

Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0, 10.1, 10.2
    • 10.2.1
    • Parser
    • None
    • 10.2.1-5

    Description

      This script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10);
      SELECT 1 UNION (SELECT 2 FROM t1 GROUP BY 1 WITH ROLLUP);
      

      returns a wrong error message:

      ERROR 1221 (HY000): Incorrect usage of CUBE/ROLLUP and ORDER BY
      

      If I remove parentheses:

      SELECT 1 UNION SELECT 2 FROM t1 GROUP BY 1 WITH ROLLUP;
      

      it returns a result:

      +------+
      | 1    |
      +------+
      |    1 |
      |    2 |
      | NULL |
      +------+
      

      If I rewrite the query the other way around:

      (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP) UNION SELECT 2;
      

      it returns a result:

      +------+
      | 1    |
      +------+
      |    1 |
      | NULL |
      |    2 |
      +------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.