mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
Ported the test case for MDEV-25682 from 10.2
No fix for this bug is needed starting from version 10.4.
This commit is contained in:
parent
ddddfc33c7
commit
bb28bffc3e
2 changed files with 41 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 #
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue