Skip to content

Commit 4a3e94e

Browse files
committed
MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
Add a testcase. The bug itself was fixed by the fix for MDEV-7316.
1 parent f825b5a commit 4a3e94e

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

mysql-test/r/selectivity_innodb.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,30 @@ select * from t1 where col2 != true;
15121512
col1 col2
15131513
drop table t1;
15141514
#
1515+
# MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
1516+
#
1517+
CREATE TABLE t1 (
1518+
parent_id int,
1519+
child_group_id int,
1520+
child_user_id int,
1521+
KEY (parent_id,child_group_id,child_user_id)
1522+
) ENGINE=InnoDB;
1523+
CREATE TABLE t2 (
1524+
id int,
1525+
lower_group_name varchar(255),
1526+
directory_id int(20),
1527+
UNIQUE KEY (directory_id)
1528+
) ENGINE=InnoDB;
1529+
CREATE TABLE t3 (id int) ENGINE=InnoDB;
1530+
insert into t1 values (1,1,1),(2,2,2);
1531+
insert into t2 values (10,'foo',10),(20,'bar',20);
1532+
insert into t3 values (101),(102);
1533+
set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
1534+
select * from t1, t2, t3
1535+
where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_name='foo' and t1.parent_id=t2.id and t2.directory_id=10;
1536+
parent_id child_group_id child_user_id id lower_group_name directory_id id
1537+
drop table t1,t2,t3;
1538+
#
15151539
# End of 10.0 tests
15161540
#
15171541
set use_stat_tables= @tmp_ust;

mysql-test/t/selectivity_innodb.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,36 @@ select * from t1 where col2 != true;
7979

8080
drop table t1;
8181

82+
--echo #
83+
--echo # MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
84+
--echo #
85+
86+
CREATE TABLE t1 (
87+
parent_id int,
88+
child_group_id int,
89+
child_user_id int,
90+
KEY (parent_id,child_group_id,child_user_id)
91+
) ENGINE=InnoDB;
92+
93+
CREATE TABLE t2 (
94+
id int,
95+
lower_group_name varchar(255),
96+
directory_id int(20),
97+
UNIQUE KEY (directory_id)
98+
) ENGINE=InnoDB;
99+
100+
CREATE TABLE t3 (id int) ENGINE=InnoDB;
101+
102+
insert into t1 values (1,1,1),(2,2,2);
103+
insert into t2 values (10,'foo',10),(20,'bar',20);
104+
insert into t3 values (101),(102);
105+
set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
106+
107+
select * from t1, t2, t3
108+
where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_name='foo' and t1.parent_id=t2.id and t2.directory_id=10;
109+
110+
drop table t1,t2,t3;
111+
82112
--echo #
83113
--echo # End of 10.0 tests
84114
--echo #

0 commit comments

Comments
 (0)