Commit ae7207da authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

merge

parents d94deb4a 8392fa83
...@@ -802,4 +802,24 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1 ...@@ -802,4 +802,24 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1
f12 f12
y y
DROP TABLE t1,t2,t3; 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; set optimizer_switch=@subselect_sj2_tmp;
...@@ -813,6 +813,26 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1 ...@@ -813,6 +813,26 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1
f12 f12
y y
DROP TABLE t1,t2,t3; 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; set optimizer_switch=@subselect_sj2_tmp;
set join_cache_level=default; set join_cache_level=default;
show variables like 'join_cache_level'; show variables like 'join_cache_level';
......
This diff is collapsed.
This diff is collapsed.
...@@ -988,5 +988,25 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1 ...@@ -988,5 +988,25 @@ WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
--echo #
--echo # BUG#869012: Wrong result with semijoin + materialization + AND in WHERE
--echo #
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 ;
set optimizer_switch= @tmp_869012;
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp; set optimizer_switch=@subselect_sj2_tmp;
...@@ -7969,7 +7969,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) ...@@ -7969,7 +7969,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/ */
JOIN_TAB *first_inner_tab= tab->first_inner; JOIN_TAB *first_inner_tab= tab->first_inner;
if (tab->table) if (!tab->bush_children)
current_map= tab->table->map; current_map= tab->table->map;
else else
current_map= tab->bush_children->start->emb_sj_nest->sj_inner_tables; current_map= tab->bush_children->start->emb_sj_nest->sj_inner_tables;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment