diff options
author | unknown <sanja@montyprogram.com> | 2012-04-05 23:32:57 +0300 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2012-04-05 23:32:57 +0300 |
commit | 1a48919036a7746a15ff6bd19cb52c25fc6a57c1 (patch) | |
tree | 0f5bd918b9c369c6a8541faccf3f3409775c98a6 /mysql-test/t/derived_view.test | |
parent | cc2298ebb7e1225d6a293281bc949d746040d547 (diff) | |
download | mariadb-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/t/derived_view.test')
-rw-r--r-- | mysql-test/t/derived_view.test | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index d1ed2ff5ba6..03d308b6c45 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -1380,6 +1380,43 @@ SET SESSION optimizer_switch= @save_optimizer_switch; DROP VIEW v; DROP TABLE t1,t2; +--echo # +--echo # LP BUG#968720 crash due to converting to materialized and +--echo # natural join made only once +--echo # + +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; + +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; +EXECUTE stmt; +SELECT * FROM t1; + +drop table t1,t2; +set optimizer_switch=@save968720_optimizer_switch; + +--echo # +--echo # end of 5.3 tests +--echo # + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; set join_cache_level=@exit_join_cache_level; |