1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-13 21:42:58 +03:00

Merge polly.(none):/home/kaa/src/opt/bug32202/my51-bug26215

into  polly.(none):/home/kaa/src/opt/mysql-5.1-opt
This commit is contained in:
kaa@polly.(none)
2007-11-10 22:48:17 +03:00
3 changed files with 113 additions and 4 deletions

View File

@@ -790,6 +790,41 @@ drop table t1;
SET SQL_MODE = '';
#
#
# Bug #32202: ORDER BY not working with GROUP BY
#
CREATE TABLE t1(
id INT AUTO_INCREMENT PRIMARY KEY,
c1 INT NOT NULL,
c2 INT NOT NULL,
UNIQUE KEY (c2,c1));
INSERT INTO t1(c1,c2) VALUES (5,1), (4,1), (3,5), (2,3), (1,3);
# Show that the test cases from the bug report pass
SELECT * FROM t1 ORDER BY c1;
SELECT * FROM t1 GROUP BY id ORDER BY c1;
# Show that DESC is handled correctly
SELECT * FROM t1 GROUP BY id ORDER BY id DESC;
# Show that results are correctly ordered when ORDER BY fields
# are a subset of GROUP BY ones
SELECT * FROM t1 GROUP BY c2 ,c1, id ORDER BY c2, c1;
SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1;
SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1 DESC;
# Show that results are correctly ordered when GROUP BY fields
# are a subset of ORDER BY ones
SELECT * FROM t1 GROUP BY c2 ORDER BY c2, c1;
SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1;
SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC;
DROP TABLE t1;
--echo End of 5.0 tests
# Bug #21174: Index degrades sort performance and
# optimizer does not honor IGNORE INDEX.
# a.k.a WL3527.