mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
BUG#20389: Crash when using index scan in reverse order
mysql-test/r/partition_order.result: Changed a test case to handle ordered index scan reverse order as well mysql-test/t/partition_order.test: Changed a test case to handle ordered index scan reverse order as well sql/ha_myisam.cc: More debug info sql/ha_partition.cc: Introduced partition_index_read_last to ensure we use index_read_last in those cases towards underlying handler. Ensured that index_read with HA_READ_PREFIX_LAST, HA_READ_PREFIX_LAST_OR_PREV and HA_READ_BEFORE_KEY uses ordered index scan in reverse order. sql/ha_partition.h: Introduced partition_index_read_last to ensure we use index_read_last in those cases towards underlying handler. Ensured that index_read with HA_READ_PREFIX_LAST, HA_READ_PREFIX_LAST_OR_PREV and HA_READ_BEFORE_KEY uses ordered index scan in reverse order.
This commit is contained in:
parent
16c54768ba
commit
dd72905716
5 changed files with 98 additions and 14 deletions
|
|
@ -718,7 +718,11 @@ partitions 2
|
|||
partition x2 values less than (100));
|
||||
INSERT into t1 values (1, 1);
|
||||
INSERT into t1 values (5, NULL);
|
||||
INSERT into t1 values (2, 5);
|
||||
INSERT into t1 values (2, 4);
|
||||
INSERT into t1 values (3, 3);
|
||||
INSERT into t1 values (4, 5);
|
||||
INSERT into t1 values (7, 1);
|
||||
INSERT into t1 values (6, 6);
|
||||
INSERT into t1 values (30, 4);
|
||||
INSERT into t1 values (35, 2);
|
||||
INSERT into t1 values (40, NULL);
|
||||
|
|
@ -727,7 +731,55 @@ a b
|
|||
5 NULL
|
||||
40 NULL
|
||||
1 1
|
||||
7 1
|
||||
35 2
|
||||
3 3
|
||||
2 4
|
||||
30 4
|
||||
2 5
|
||||
4 5
|
||||
6 6
|
||||
select * from t1 force index (b) where b < 10 ORDER BY b;
|
||||
a b
|
||||
1 1
|
||||
7 1
|
||||
35 2
|
||||
3 3
|
||||
2 4
|
||||
30 4
|
||||
4 5
|
||||
6 6
|
||||
select * from t1 force index (b) where b < 10 ORDER BY b DESC;
|
||||
a b
|
||||
6 6
|
||||
4 5
|
||||
2 4
|
||||
30 4
|
||||
3 3
|
||||
35 2
|
||||
7 1
|
||||
1 1
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b int, c varchar(20), key (a,b,c))
|
||||
partition by range (b)
|
||||
(partition p0 values less than (5),
|
||||
partition p1 values less than (10));
|
||||
INSERT into t1 values (1,1,'1'),(2,2,'2'),(1,3,'3'),(2,4,'4'),(1,5,'5');
|
||||
INSERT into t1 values (2,6,'6'),(1,7,'7'),(2,8,'8'),(1,9,'9');
|
||||
INSERT into t1 values (1, NULL, NULL), (2, NULL, '10');
|
||||
select * from t1 where a = 1 order by a desc, b desc;
|
||||
a b c
|
||||
1 9 9
|
||||
1 7 7
|
||||
1 5 5
|
||||
1 3 3
|
||||
1 1 1
|
||||
1 NULL NULL
|
||||
select * from t1 where a = 1 order by b desc;
|
||||
a b c
|
||||
1 9 9
|
||||
1 7 7
|
||||
1 5 5
|
||||
1 3 3
|
||||
1 1 1
|
||||
1 NULL NULL
|
||||
drop table t1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue