From c050b5fdf9564e5ffd98ff381c61504efdf69f99 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 2 Jan 2014 15:51:02 +0200 Subject: Fixed MDEV-5424: SELECT using ORDER BY DESC and LIMIT produces unexpected results (InnoDB/XtraDB) This only happend when using an ORDER BY on a primary key part, where all other key parts where constant. Remove of duplicated expressions in ORDER BY (as the old code did this in some strange cases) mysql-test/r/group_by.result: Fixed results to take into account that duplicate order by parts are now deleted mysql-test/r/group_by_innodb.result: Ensure extended keys are on mysql-test/r/innodb_ext_key.result: More tests mysql-test/r/order_by.result: More tests mysql-test/t/group_by.test: Fixed results to take into account that duplicate order by parts are now deleted mysql-test/t/group_by_innodb.test: Ensure extended keys are on mysql-test/t/innodb_ext_key.test: More tests mysql-test/t/order_by.test: More tests sql/sql_select.cc: Fixed bug where we looked at extended key parts when we shouldn't Remove of duplicated expressions in ORDER BY sql/table.cc: Indentation fixes --- mysql-test/t/order_by.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mysql-test/t/order_by.test') diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 3e20d22d726..35f1a7f744b 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -261,6 +261,9 @@ desc,b desc; explain select * from t1 where a = 2 and b > 0 order by a desc,b desc; explain select * from t1 where a = 2 and b < 2 order by a desc,b desc; explain select * from t1 where a = 1 order by b desc; +explain select * from t1 where a = 2 and b > 0 order by a desc,b desc,b,a; +explain select * from t1 where a = 2 and b < 2 order by a desc,a,b desc,a,b; + select * from t1 where a = 1 order by b desc; # # Test things when we don't have NULL keys -- cgit v1.2.1