diff options
author | unknown <igor@olga.mysql.com> | 2007-12-14 13:42:46 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-12-14 13:42:46 -0800 |
commit | 3f6073ae63f9cb738cb6f0a6a8136e1d21ba0e1b (patch) | |
tree | a4ca84ac2c8b4f8379b7c58993dccf27019214d4 /mysql-test/r/union.result | |
parent | e51e6097b98eb4faae8fec4704feab251d8031dc (diff) | |
download | mariadb-git-3f6073ae63f9cb738cb6f0a6a8136e1d21ba0e1b.tar.gz |
Fixed bug #27848.
In a union without braces, the order by at the end is applied to the
overall union. It therefore should not interfere with the individual
select parts of the union.
Fixed by changing our parser rules appropriately.
mysql-test/r/union.result:
Added a test case for bug #27848.
mysql-test/t/union.test:
Added a test case for bug #27848.
Diffstat (limited to 'mysql-test/r/union.result')
-rw-r--r-- | mysql-test/r/union.result | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index efdd8195fb5..c7a6035aab2 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1389,4 +1389,55 @@ select @var; 1 (select 2) union (select 1 into @var); ERROR 42000: Result consisted of more than one row +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (10), (20); +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES (10), (50), (50); +SELECT a,1 FROM t1 +UNION +SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP +ORDER BY a; +a 1 +NULL 3 +10 1 +20 1 +50 2 +SELECT a,1 FROM t1 +UNION +SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP +ORDER BY a DESC; +a 1 +50 2 +20 1 +10 1 +NULL 3 +SELECT a,1 FROM t1 +UNION +SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP +ORDER BY a ASC LIMIT 3; +a 1 +NULL 3 +10 1 +20 1 +SELECT a,1 FROM t1 +UNION ALL +SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP +ORDER BY a DESC; +a 1 +50 2 +20 1 +10 1 +10 1 +NULL 3 +SELECT a,1 FROM t1 +UNION +(SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a); +ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY +SELECT a,1 FROM t1 +UNION ALL +SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a +UNION +SELECT 1,1; +ERROR HY000: Incorrect usage of UNION and ORDER BY +DROP TABLE t1,t2; End of 5.0 tests |