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

Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5, 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),(20),(30);
      SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP;
      

      correctly returns

      +------+----------------------------+
      | a    | GROUP_CONCAT(a ORDER BY a) |
      +------+----------------------------+
      |   10 | 10                         |
      |   20 | 20                         |
      |   30 | 30                         |
      | NULL | 10,20,30                   |
      +------+----------------------------+
      

      These queries return an error:

      SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30';
      SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1;
      SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30');
      

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

        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: