summaryrefslogtreecommitdiff
path: root/mysql-test/r/derived_view.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-29 16:05:16 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-29 16:05:16 -0700
commitbd62c82380205612162add4cac13cae26588879c (patch)
tree1864e1fe64b0859e989be38fc8967822f5d54f9d /mysql-test/r/derived_view.result
parenta853c7dd187a1961da14ad18ed8d2b85b1ea75ba (diff)
downloadmariadb-git-bd62c82380205612162add4cac13cae26588879c.tar.gz
Fixed LP bug #803410.
Due to this bug in the function generate_derived_keys_for_table some key definitions to access materialized derived tables or materialized views were constructed with invalid info for their key parts. This could make the server crash when it optimized queries using materialized derived tables or materialized views.
Diffstat (limited to 'mysql-test/r/derived_view.result')
-rw-r--r--mysql-test/r/derived_view.result22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index be6050ab48e..c78b2a41d19 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -703,3 +703,25 @@ a
NULL
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+#
+# LP bug #803410: materialized view/dt accessed by two-component key
+#
+CREATE TABLE t1 (a varchar(1));
+INSERT INTO t1 VALUES ('c');
+CREATE TABLE t2 (a varchar(1) , KEY (a)) ;
+INSERT INTO t2 VALUES ('c'), (NULL), ('r');
+CREATE TABLE t3 (a varchar(1), b varchar(1));
+INSERT INTO t3 VALUES ('e', 'c'), ('c', 'c'), ('c', 'r');
+CREATE VIEW v1 AS SELECT a, MIN(b) AS b FROM t3 GROUP BY a;
+EXPLAIN
+SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ref a a 4 const 1 Using index
+1 PRIMARY <derived2> ref key1 key1 10 test.t1.a,test.t1.a 2 Using where
+2 DERIVED t3 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
+a a a b
+c c c c
+DROP VIEW v1;
+DROP TABLE t1,t2,t3;