summaryrefslogtreecommitdiff
path: root/mysql-test/t/derived_view.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-07-06 17:24:42 -0700
committerIgor Babaev <igor@askmonty.org>2011-07-06 17:24:42 -0700
commitb79316f5833fe3c2935861f9350bcfc05414ba89 (patch)
tree6645c5cb4ad7b4788d0d5dd6b1d055fcaa0091d1 /mysql-test/t/derived_view.test
parentdb36ce1de0c81b59b8fb5feea1942c52264491cd (diff)
downloadmariadb-git-b79316f5833fe3c2935861f9350bcfc05414ba89.tar.gz
Fixed LP bug #806431.
The function generate_derived_keys_for_table incorrectly handled the cases when a materialized view or derived table could be accessed by different keys on the same fields if these keys depended on the same tables.
Diffstat (limited to 'mysql-test/t/derived_view.test')
-rw-r--r--mysql-test/t/derived_view.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 33ba752cc2f..1c91acdf14a 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -414,3 +414,24 @@ SELECT t.f1 AS f
DROP TABLE t1,t2,t3,t4;
+--echo #
+--echo # LP bug #806431: join over materialized derived with key
+--echo #
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (0,0),(3,0),(1,0);
+
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT a,b FROM t1 ;
+
+SET SESSION optimizer_switch='derived_with_keys=off';
+SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
+SET SESSION optimizer_switch='derived_with_keys=on';
+EXPLAIN
+SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
+SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
+
+SET SESSION optimizer_switch=default;
+
+DROP VIEW v1;
+DROP TABLE t1;
+