summaryrefslogtreecommitdiff
path: root/mysql-test/r/derived.result
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/r/derived.result
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/r/derived.result')
-rw-r--r--mysql-test/r/derived.result18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 7cc2af3616f..fe803ed37a5 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -407,3 +407,21 @@ MIN(i)
1
DROP TABLE t1;
# End of 5.0 tests
+#
+# LP bug #793436: query with a derived table for which optimizer proves
+# that it contains not more than 1 row
+#
+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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+1 PRIMARY t1 ref a a 5 const 1 Using index
+2 DERIVED t2 system NULL NULL NULL NULL 1
+SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
+a a
+3 3
+DROP TABLE t1,t2;