1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-31494 Server crashes in ha_partition::index_blocks / get_key_scans_params

MDEV-31445 Server crashes in ha_partition::index_blocks / cost_for_index_read

The crash happened in the case where partition pruning finds 0
partitions.
This commit is contained in:
Monty
2023-06-21 14:00:18 +03:00
parent f25a74c0b0
commit d3c81804ba
3 changed files with 76 additions and 1 deletions

View File

@ -2858,3 +2858,41 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key
set optimizer_switch=@tmp_os;
drop table t1,t2,t3;
#
# MDEV-31494 Server crashes in ha_partition::index_blocks /
# get_key_scans_params
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT, c INT, KEY(c)) PARTITION BY LIST (b) (PARTITION p0 VALUES IN (1,2), PARTITION p1 VALUES IN (3,4));
INSERT INTO t2 VALUES (1,1),(2,2);
explain SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE t2.b = 5 AND t2.c = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE t2.b = 5 AND t2.c = 10;
a b c
DROP TABLE t1, t2;
#
# MDEV-31445 Server crashes in ha_partition::index_blocks /
# cost_for_index_read
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
CREATE TABLE t3 (c INT, d INT, KEY(d)) PARTITION BY KEY (c) PARTITIONS 2;
CREATE TABLE t4 (e INT);
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 VALUES (1),(2);
INSERT INTO t3 VALUES (1,1),(2,2);
INSERT INTO t4 VALUES (1),(2);
explain SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON (0 IN (SELECT e FROM t4) AND t3.d = t2.b)) ON (t3.c < t2.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t3 ref d d 5 test.t2.b 1 Using where
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON (0 IN (SELECT e FROM t4) AND t3.d = t2.b)) ON (t3.c < t2.b);
a b c d
1 NULL NULL NULL
2 NULL NULL NULL
drop table t1,t2,t3,t4;
# End of 11.0 tests