summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_sj.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-09-05 19:28:22 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-09-05 19:28:22 +0400
commit6035d0d755a2465421da3ac845ab970c504c90d7 (patch)
tree49fde7bf0b4d50ec2cb5d8b25ea4054b77be749f /mysql-test/t/subselect_sj.test
parent55cde3b428a66808359f5dfd1458f84c26793bac (diff)
downloadmariadb-git-6035d0d755a2465421da3ac845ab970c504c90d7.tar.gz
BUG#834758: Wrong result with innner join, LooseScan, two-column IN() predicate
- get_bound_sj_equalities() would produce incorrect bitmap when non-first equality was bound, which resulted in invalid LooseScan plans.
Diffstat (limited to 'mysql-test/t/subselect_sj.test')
-rw-r--r--mysql-test/t/subselect_sj.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index a175a2f7cf0..5d34c4d6393 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -1594,5 +1594,29 @@ WHERE (t3.a) IN (
);
drop table t1, t2,t3;
+--echo #
+--echo # BUG#834758: Wrong result with innner join, LooseScan, two-column IN() predicate
+--echo #
+
+set @tmp835758=@@optimizer_switch;
+set optimizer_switch='semijoin=on,loosescan=on,materialization=off,firstmatch=off';
+
+CREATE TABLE t1 (b int) ;
+INSERT INTO t1 VALUES (1),(5);
+
+CREATE TABLE t2 (a int, PRIMARY KEY (a)) ;
+INSERT INTO t2 VALUES (6),(10);
+
+CREATE TABLE t3 (a int, b int, KEY (b)) ;
+INSERT INTO t3 VALUES (6,5),(6,2),(8,0),(9,1),(6,5);
+
+--echo # This used to incorrectly pick a join order of (t1, LooseScan(t3), t2):
+explain
+SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3);
+SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3);
+
+DROP TABLE t1, t2, t3;
+set @@optimizer_switch= @tmp835758;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;