summaryrefslogtreecommitdiff
path: root/mysql-test/t/derived.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-06 12:19:35 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-06 12:19:35 -0700
commitdb0c3406011d9a6d6fdb98c1c1f7925d243bd1f9 (patch)
tree7288647c4e707fffc4362f4c71198c99be828231 /mysql-test/t/derived.test
parent3bf08e549a78ad12191f6b1ca49719bc667664ef (diff)
downloadmariadb-git-db0c3406011d9a6d6fdb98c1c1f7925d243bd1f9.tar.gz
Fixed LP bug #793436.
When looking for the execution plan of a derived table to be materialized JOIN::optimize finds out that all joined tables of the derived table contain not more than one row then the derived table should be maretialized at the optimization stage. Added a test case for the bug. Adjusted results in other test cases.
Diffstat (limited to 'mysql-test/t/derived.test')
-rw-r--r--mysql-test/t/derived.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 962cec95add..75368925499 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -315,3 +315,19 @@ WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3;
DROP TABLE t1;
--echo # End of 5.0 tests
+
+--echo #
+--echo # LP bug #793436: query with a derived table for which optimizer proves
+--echo # that it contains not more than 1 row
+--echo #
+
+CREATE TABLE t1 (a int, KEY (a)) ;
+INSERT INTO t1 VALUES (3), (1);
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (3);
+
+EXPLAIN
+SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
+SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
+
+DROP TABLE t1,t2;