summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_outer.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-09-06 07:17:39 -0700
committerIgor Babaev <igor@askmonty.org>2011-09-06 07:17:39 -0700
commitda59130ec18a5801080a034a3c1cb442f1ad4498 (patch)
tree0fc54554be489011905a9f3f15f5f2c3d0b656ab /mysql-test/t/join_outer.test
parent26bd06feef0d3f2e6f0a20457db1f8397117d2d5 (diff)
downloadmariadb-git-da59130ec18a5801080a034a3c1cb442f1ad4498.tar.gz
Fixed LP bug #838633.
For any query JOIN::optimize() should call the method SELECT::save_leaf_tables after the last transformation that utilizes the statement memory rather than the execution memory.
Diffstat (limited to 'mysql-test/t/join_outer.test')
-rw-r--r--mysql-test/t/join_outer.test34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index d47ceab6b74..2311edc46b7 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1173,3 +1173,37 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
+
+--echo #
+--echo # LP bug #838633: second execution of PS with outer join
+--echo # converted to inner join
+--echo #
+
+CREATE TABLE t1 ( b int NOT NULL ) ;
+INSERT INTO t1 VALUES (9),(10);
+
+CREATE TABLE t2 ( b int NOT NULL, PRIMARY KEY (b)) ;
+INSERT INTO t2 VALUES
+ (75),(76),(77),(78),(79),(80),(81),(82),(83),(84),(85),(86),(87),(88),(89),
+ (10), (90),(91),(92),(93),(94),(95),(96),(97),(98),(99),(100);
+
+CREATE TABLE t3 ( a int, b int NOT NULL , PRIMARY KEY (b)) ;
+INSERT INTO t3 VALUES
+ (0,6),(0,7),(0,8),(2,9),(0,10),(2,21),(0,22),(2,23),(2,24),(2,25);
+
+SET SESSION join_cache_level=4;
+
+EXPLAIN EXTENDED
+SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
+
+PREPARE stmt FROM
+'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+SET SESSION join_cache_level=default;
+
+DROP TABLE t1,t2,t3;