diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2023-02-21 12:04:37 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2023-02-21 15:27:23 +0300 |
commit | d61bc94fa02c76fc3d9b0acf22d59377fc4a5d0a (patch) | |
tree | bd4db2caeded6760982093f3ddc745ac6c1085da /mysql-test/main/selectivity.result | |
parent | d5d7c8ba96fbf8800d7273034f56cbb39f379982 (diff) | |
download | mariadb-git-d61bc94fa02c76fc3d9b0acf22d59377fc4a5d0a.tar.gz |
MDEV-30659 Server crash on EXPLAIN SELECT/SELECT on table with engine Aria for LooseScan Strategy
Amended patch from Monty:
The issue was that Loose_scan_opt::save_to_position() did not take
into account records_out from best_access_path()
Make sure that POSITION object filled by Loose_scan_opt::save_to_position()
has records_out not higher than any other possible access method.
Diffstat (limited to 'mysql-test/main/selectivity.result')
-rw-r--r-- | mysql-test/main/selectivity.result | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result index e8ec0c30e80..6bd8fdf8d2b 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -2011,3 +2011,57 @@ INSERT INTO t2 VALUES (1),(2); SELECT STRAIGHT_JOIN pk FROM t1 JOIN t2 ON a = pk WHERE b >= 'A' ORDER BY t2.pk LIMIT 8 OFFSET 1; pk DROP TABLE t1, t2; +# +# MDEV-30659 Server crash on EXPLAIN SELECT/SELECT on table with +# engine Aria for LooseScan Strategy +# +create table t1 (old_c1 integer, old_c2 integer, c1 integer, +c2 integer, c3 integer) engine=aria; +insert into t1(c1,c2,c3) +values (1,1,1), (1,2,2), (1,3,3), +(2,1,4), (2,2,5), (2,3,6), +(2,4,7), (2,5,8); +create index t1_c2 on t1 (c2,c1); +explain select * from t1 where t1.c2 in (select a.c2 from t1 a) and +c2 >= 3 order by c2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY a range t1_c2 t1_c2 5 NULL 5 Using where; Using index; LooseScan +1 PRIMARY t1 ref t1_c2 t1_c2 5 test.a.c2 1 +drop table t1; +create table t1 (old_c1 integer, old_c2 integer, c1 integer, +c2 integer, c3 integer) engine=aria; +create trigger trg_t1 before update on t1 for each row +begin +set new.old_c1=old.c1; +set new.old_c2=old.c2; +end; +/ +insert into t1 (c1,c2,c3) values +(1,1,1), (1,2,2), (1,3,3), (2,1,4), (2,2,5), (2,3,6), (2,4,7), (2,5,8); +create index t1_c2 on t1 (c2,c1); +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +create table t2 as select * from t1; +truncate table t1; +insert into t1 select * from t2; +explain select * from t1 where t1.c2 in (select a.c2 from t1 a) and c2 >= 3 order by c2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY a range t1_c2 t1_c2 5 NULL 5 Using where; Using index; LooseScan +1 PRIMARY t1 ref t1_c2 t1_c2 5 test.a.c2 1 +drop trigger trg_t1; +drop table t1,t2; +create table t1 (old_c1 integer, old_c2 integer, c1 integer, +c2 integer, c3 integer) engine=aria; +insert into t1 (c1,c2,c3) values +(1,1,1), (1,2,2), (1,3,3), (2,1,4), (2,2,5), (2,3,6), (2,4,7), (2,5,8); +create index t1_c2 on t1 (c2,c1); +create table t2 as select * from t1; +truncate table t1; +insert into t1 select * from t2; +explain select * from t1 where t1.c2 in (select a.c2 from t1 a) and c2 >= 3 order by c2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY a range t1_c2 t1_c2 5 NULL 5 Using where; Using index; LooseScan +1 PRIMARY t1 ref t1_c2 t1_c2 5 test.a.c2 2 +drop table t1,t2; |