mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
BUG#860535: Assertion `keypart_map' failed in mi_rkey with semijoin
- are_tables_local() failed to recognize the fact that OUTER_REF_TABLE_BIT is ok for SJ-Materialization. This caused zero-length ref access to be constructed, which led to an assert.
This commit is contained in:
parent
b53744b79e
commit
134e417895
4 changed files with 87 additions and 1 deletions
|
@ -1675,6 +1675,34 @@ GROUP BY t4.f6);
|
|||
f4
|
||||
DROP TABLE t1,t3,t4;
|
||||
set optimizer_switch=@tmp_860300;
|
||||
#
|
||||
# BUG#860535: Assertion `keypart_map' failed in mi_rkey with semijoin
|
||||
#
|
||||
set @tmp_860535=@@optimizer_switch;
|
||||
set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
|
||||
CREATE TABLE t1 (f3 int) ;
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (f3 int , f5 varchar(1), KEY (f3)) ;
|
||||
INSERT INTO t2 VALUES (7,'b');
|
||||
CREATE TABLE t3 (f3 int , f4 varchar(1) , KEY(f3), KEY (f4,f3)) ;
|
||||
INSERT INTO t3 VALUES (1,'t'),(7,'g');
|
||||
CREATE TABLE t4
|
||||
SELECT f3
|
||||
FROM t1 WHERE ( f3 ) NOT IN (
|
||||
SELECT f3
|
||||
FROM t2
|
||||
WHERE f5 IN (
|
||||
SELECT f4
|
||||
FROM t3
|
||||
WHERE t3.f3 < 3
|
||||
)
|
||||
);
|
||||
SELECT * FROM t4;
|
||||
f3
|
||||
1
|
||||
7
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
set optimizer_switch=@tmp_860535;
|
||||
set @subselect_mat_test_optimizer_switch_value=null;
|
||||
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
|
||||
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
|
||||
|
|
|
@ -1715,3 +1715,31 @@ GROUP BY t4.f6);
|
|||
f4
|
||||
DROP TABLE t1,t3,t4;
|
||||
set optimizer_switch=@tmp_860300;
|
||||
#
|
||||
# BUG#860535: Assertion `keypart_map' failed in mi_rkey with semijoin
|
||||
#
|
||||
set @tmp_860535=@@optimizer_switch;
|
||||
set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
|
||||
CREATE TABLE t1 (f3 int) ;
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
CREATE TABLE t2 (f3 int , f5 varchar(1), KEY (f3)) ;
|
||||
INSERT INTO t2 VALUES (7,'b');
|
||||
CREATE TABLE t3 (f3 int , f4 varchar(1) , KEY(f3), KEY (f4,f3)) ;
|
||||
INSERT INTO t3 VALUES (1,'t'),(7,'g');
|
||||
CREATE TABLE t4
|
||||
SELECT f3
|
||||
FROM t1 WHERE ( f3 ) NOT IN (
|
||||
SELECT f3
|
||||
FROM t2
|
||||
WHERE f5 IN (
|
||||
SELECT f4
|
||||
FROM t3
|
||||
WHERE t3.f3 < 3
|
||||
)
|
||||
);
|
||||
SELECT * FROM t4;
|
||||
f3
|
||||
1
|
||||
7
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
set optimizer_switch=@tmp_860535;
|
||||
|
|
|
@ -1370,3 +1370,32 @@ WHERE 'h' IN (SELECT f6
|
|||
DROP TABLE t1,t3,t4;
|
||||
set optimizer_switch=@tmp_860300;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#860535: Assertion `keypart_map' failed in mi_rkey with semijoin
|
||||
--echo #
|
||||
set @tmp_860535=@@optimizer_switch;
|
||||
set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
|
||||
CREATE TABLE t1 (f3 int) ;
|
||||
INSERT INTO t1 VALUES (1),(7);
|
||||
|
||||
CREATE TABLE t2 (f3 int , f5 varchar(1), KEY (f3)) ;
|
||||
INSERT INTO t2 VALUES (7,'b');
|
||||
|
||||
CREATE TABLE t3 (f3 int , f4 varchar(1) , KEY(f3), KEY (f4,f3)) ;
|
||||
INSERT INTO t3 VALUES (1,'t'),(7,'g');
|
||||
|
||||
CREATE TABLE t4
|
||||
SELECT f3
|
||||
FROM t1 WHERE ( f3 ) NOT IN (
|
||||
SELECT f3
|
||||
FROM t2
|
||||
WHERE f5 IN (
|
||||
SELECT f4
|
||||
FROM t3
|
||||
WHERE t3.f3 < 3
|
||||
)
|
||||
);
|
||||
SELECT * FROM t4;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
set optimizer_switch=@tmp_860535;
|
||||
|
||||
|
|
|
@ -7239,7 +7239,8 @@ static bool are_tables_local(JOIN_TAB *jtab, table_map used_tables)
|
|||
except the const tables.
|
||||
*/
|
||||
table_map local_tables= jtab->emb_sj_nest->nested_join->used_tables |
|
||||
jtab->join->const_table_map;
|
||||
jtab->join->const_table_map |
|
||||
OUTER_REF_TABLE_BIT;
|
||||
return !test(used_tables & ~local_tables);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue