diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-07-09 14:01:06 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-07-10 00:01:24 +0530 |
commit | 737c3025e9ed55855ee66806ad14e9e7e7852fa7 (patch) | |
tree | 1798ffb7d1a2229f28e32089b76286139ad2d32d /mysql-test/r/union.result | |
parent | a759f9af51b2093502d3a06c0150e9aa7fc21068 (diff) | |
download | mariadb-git-737c3025e9ed55855ee66806ad14e9e7e7852fa7.tar.gz |
MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT()
Reject queries that have aggregate functions with UNION as these
are not allowed by standard.
Diffstat (limited to 'mysql-test/r/union.result')
-rw-r--r-- | mysql-test/r/union.result | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c02e590490e..f9df02b7f81 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1757,8 +1757,7 @@ union select 4 order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION prepare stmt1 from 'select 1 as foo union select 2 @@ -1768,12 +1767,7 @@ union select 4 order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) '; -execute stmt1; -foo -1 -execute stmt1; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION select 1 as foo union select 2 @@ -1783,8 +1777,7 @@ union (select 4) order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION prepare stmt1 from 'select 1 as foo union select 2 @@ -1794,13 +1787,7 @@ union (select 4) order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) '; -execute stmt1; -foo -1 -execute stmt1; -foo -1 -deallocate prepare stmt1; +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION End of 5.1 tests # # mdev-5091: Asseirtion failure for UNION with ORDER BY @@ -2299,3 +2286,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0 DROP TABLE t1,t2; +# +# MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT() +# +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2),(3); +(SELECT 1 AS a) UNION (SELECT a FROM t1 GROUP BY a) ORDER BY GROUP_CONCAT(a); +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION +DROP TABLE t1; |