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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.0
    • Fix Version/s: 10.2.1
    • Component/s: Parser
    • Labels:
      None
    • Sprint:
      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

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: