summaryrefslogtreecommitdiff
path: root/mysql-test/r/derived_view.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-09 12:43:28 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-09 12:43:28 -0700
commitab411f8f1c2e84082623c038eb024c15c58745b5 (patch)
treef958e360825de8f21d39a496c62c3f8e333b7461 /mysql-test/r/derived_view.result
parent7f345153f91c5395e5ab4ce5906fcabbb6d06f51 (diff)
downloadmariadb-git-ab411f8f1c2e84082623c038eb024c15c58745b5.tar.gz
Fixed LP bug #794909.
The function generate_derived_keys did not take into account the fact that the last element in the array of keyuses could be just a barrier element. In some cases it could lead to a crash of the server. Also fixed a couple of other bugs in generate_derived_keys: the inner loop in the body of if this function did not change the cycle variables properly.
Diffstat (limited to 'mysql-test/r/derived_view.result')
-rw-r--r--mysql-test/r/derived_view.result21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 5125f91005f..5e3fc1e8cf1 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -568,3 +568,24 @@ TODO: Add test with 64 tables mergeable view to test fall back to
materialization on tables > MAX_TABLES merge
drop table t1,t2;
drop view v1,v2,v3,v4,v6,v7;
+#
+# LP bug #794909: crash when defining possible keys for
+# a materialized view/derived_table
+#
+CREATE TABLE t1 (f1 int) ;
+INSERT INTO t1 VALUES (149), (150), (224), (29);
+CREATE TABLE t2 (f1 int, KEY (f1));
+INSERT INTO t2 VALUES (149), (NULL), (224);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN
+SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 index f1 f1 5 NULL 3 Using where; Using index
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.f1 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 4
+SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1;
+f1 f1
+149 149
+224 224
+DROP VIEW v1;
+DROP TABLE t1,t2;