summaryrefslogtreecommitdiff
path: root/mysql-test/r/derived_view.result
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-04-05 23:32:57 +0300
committerunknown <sanja@montyprogram.com>2012-04-05 23:32:57 +0300
commit1a48919036a7746a15ff6bd19cb52c25fc6a57c1 (patch)
tree0f5bd918b9c369c6a8541faccf3f3409775c98a6 /mysql-test/r/derived_view.result
parentcc2298ebb7e1225d6a293281bc949d746040d547 (diff)
downloadmariadb-git-1a48919036a7746a15ff6bd19cb52c25fc6a57c1.tar.gz
Fix of LP bug#968720.
When a view/derived table is converted from merged to materialized the items from the used_item lists are substituted for items referring to the fields of the result of the materialization. The problem appeared with queries employing natural joins. Since the resolution of a natural join was performed only once the used_item list formed at the second execution of the query lacked the references to the fields that were used only in the equality predicates generated for the natural join.
Diffstat (limited to 'mysql-test/r/derived_view.result')
-rw-r--r--mysql-test/r/derived_view.result39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 28c4c362a9d..3151bb14657 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -1997,5 +1997,44 @@ a b gc
SET SESSION optimizer_switch= @save_optimizer_switch;
DROP VIEW v;
DROP TABLE t1,t2;
+#
+# LP BUG#968720 crash due to converting to materialized and
+# natural join made only once
+#
+SET @save968720_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on';
+CREATE TABLE t1 (a int, INDEX(a));
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (a int, INDEX(a));
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
+t2 AS s2;
+SELECT * FROM t1;
+a
+1
+1
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+PREPARE stmt FROM "
+INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
+t2 AS s2;
+";
+EXECUTE stmt;
+SELECT * FROM t1;
+a
+1
+1
+EXECUTE stmt;
+SELECT * FROM t1;
+a
+1
+1
+1
+1
+drop table t1,t2;
+set optimizer_switch=@save968720_optimizer_switch;
+#
+# end of 5.3 tests
+#
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;