BUG#869012: Wrong result with semijoin + materialization + AND in WHERE

- in make_join_select(), use the correct condition to check whether the current table is a SJM nest (the previous 
  condition used to be correct before, but then sj-materialization temp table creation was moved to happen before
  make_join_select was called)
This commit is contained in:
Sergey Petrunya 2011-10-11 21:34:00 +04:00
commit 039da95e3d
6 changed files with 61 additions and 2591 deletions

View file

@ -802,4 +802,24 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1
f12
y
DROP TABLE t1,t2,t3;
#
# BUG#869012: Wrong result with semijoin + materialization + AND in WHERE
#
CREATE TABLE t1 (f3 varchar(1) , f4 varchar(1) ) engine=InnoDB;
INSERT IGNORE INTO t1 VALUES ('x','x'),('x','x');
CREATE TABLE t2 ( f4 varchar(1) ) ;
INSERT IGNORE INTO t2 VALUES ('g');
CREATE TABLE t3 (f4 varchar(1) ) Engine=InnoDB;
INSERT IGNORE INTO t3 VALUES ('x');
set @tmp_869012=@@optimizer_switch;
SET optimizer_switch='semijoin=on,materialization=on';
SELECT *
FROM t1 , t2
WHERE ( t1.f4 ) IN ( SELECT f4 FROM t3 )
AND t2.f4 != t1.f3 ;
f3 f4 f4
x x g
x x g
set optimizer_switch= @tmp_869012;
# This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;