Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
Description
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a INT) ENGINE=MyISAM; |
INSERT t1 VALUES (1),(2),(3); |
SELECT 1 AS a UNION SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY 1); |
returns this result:
+------+
|
| a |
|
+------+
|
| 1 |
|
+------+
|
This is wrong. The right part of the union alone:
SELECT * FROM t1 GROUP BY a WITH ROLLUP; |
returns
+------+
|
| a |
|
+------+
|
| 1 |
|
| 2 |
|
| 3 |
|
| NULL |
|
+------+
|
The result of a UNION can't return less rows than UNION parts alone.
The same problem is repeatable with other aggregate functions:
SELECT 1 AS a UNION SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY AVG(a); |
SELECT 1 AS a UNION SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY SUM(a); |
Attachments
Issue Links
- relates to
-
MDEV-8909 union parser cleanup
- Closed