1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fixed LP bug #887479.

The function setup_semijoin_dups_elimination erroneously assumed
that if join_cache_level is set to 3 or 4 then the type of the
access to a table cannot be JT_REF or JT_EQ_REF. This could lead
to wrong query result sets.
This commit is contained in:
Igor Babaev
2011-11-16 06:11:25 -08:00
parent 4d358f48c9
commit c05e5b9c65
3 changed files with 63 additions and 1 deletions

View File

@@ -3225,5 +3225,34 @@ SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1, t2;
--echo #
--echo # Bug #887479: join_cache_level=3 + semijoin=on
--echo #
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (3914,17), (3710,5), (3888,20);
CREATE TABLE t2 (c int, KEY (c));
INSERT INTO t2 VALUES (27), (17), (33), (20), (3), (7), (18), (2);
SET @tmp887479_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on';
SET SESSION optimizer_switch='semijoin_with_cache=on';
SET SESSION join_cache_level=1;
EXPLAIN
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
SET SESSION join_cache_level=3;
EXPLAIN
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
SET SESSION join_cache_level = DEFAULT;
SET optimizer_switch=@tmp887479_optimizer_switch;
DROP TABLE t1,t2;
# this must be the last command in the file
set @@optimizer_switch=@save_optimizer_switch;