[Commits] bb28bff: Ported the test case for MDEV-25682 from 10.2

IgorBabaev igor at mariadb.com
Tue Jun 8 05:51:57 EEST 2021


revision-id: bb28bffc3ed179a9912aced2b873e43999111887 (mariadb-10.4.11-642-gbb28bff)
parent(s): ddddfc33c7825609a25ce9531183a0b0fb97f206
author: Igor Babaev
committer: Igor Babaev
timestamp: 2021-06-07 19:51:57 -0700
message:

Ported the test case for MDEV-25682 from 10.2

No fix for this bug is needed starting from version 10.4.

---
 mysql-test/main/order_by.result | 25 +++++++++++++++++++++++++
 mysql-test/main/order_by.test   | 16 ++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index 826daf0..129bd89 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3536,6 +3536,31 @@ SET max_length_for_sort_data=@save_max_length_for_sort_data;
 SET max_sort_length= @save_max_sort_length;
 SET sql_select_limit= @save_sql_select_limit;
 DROP TABLE t1;
+#
+# MDEV-25682: EXPLAIN for SELECT with ORDER BY after [ORDER BY] LIMIT
+#
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+explain (select a from t1 limit 2) order by a desc;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	2	Using filesort
+2	DERIVED	t1	ALL	NULL	NULL	NULL	NULL	3	
+(select a from t1 limit 2) order by a desc;
+a
+7
+3
+create table t2 (a int, b int);
+insert into t2 values (3,70), (7,10), (1,40), (4,30);
+explain (select b,a from t2 order by a limit 3) order by b desc;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	3	Using filesort
+2	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	4	Using filesort
+(select b,a from t2 order by a limit 3) order by b desc;
+b	a
+70	3
+40	1
+30	4
+drop table t1,t2;
 # End of 10.2 tests
 #
 # MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY
diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test
index 1bf353f..0bf0311 100644
--- a/mysql-test/main/order_by.test
+++ b/mysql-test/main/order_by.test
@@ -2294,6 +2294,22 @@ SET max_sort_length= @save_max_sort_length;
 SET sql_select_limit= @save_sql_select_limit;
 DROP TABLE t1;
 
+--echo #
+--echo # MDEV-25682: EXPLAIN for SELECT with ORDER BY after [ORDER BY] LIMIT
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+explain (select a from t1 limit 2) order by a desc;
+(select a from t1 limit 2) order by a desc;
+
+create table t2 (a int, b int);
+insert into t2 values (3,70), (7,10), (1,40), (4,30);
+explain (select b,a from t2 order by a limit 3) order by b desc;
+(select b,a from t2 order by a limit 3) order by b desc;
+
+drop table t1,t2;
+
 --echo # End of 10.2 tests
 
 --echo #


More information about the commits mailing list