summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-05-14 16:43:36 -0700
committerIgor Babaev <igor@askmonty.org>2021-05-14 16:43:36 -0700
commit677f1ef6f00793b3ad2a42b4e6f0fcbb7cd0e39d (patch)
treeed0309fd0b6560a07fb5ccec135cc6958726d9ca /mysql-test/t
parente607f3398c69147299884d3814cf063d2e7516ce (diff)
downloadmariadb-git-677f1ef6f00793b3ad2a42b4e6f0fcbb7cd0e39d.tar.gz
MDEV-25682 Explain shows an execution plan different from actually executed
If a select query contained an ORDER BY clause that followed a LIMIT clause or an ORDER BY clause or ORDER BY with LIMIT the EXPLAIN output for the query showed an execution plan different from that was actually executed. Approved by Roman Nozdrin <roman.nozdrin@mariadb.com>
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/order_by.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 36c25ed37fb..4e50fc5b3c6 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -2293,4 +2293,20 @@ 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