summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-08-08 22:02:10 -0700
committerIgor Babaev <igor@askmonty.org>2011-08-08 22:02:10 -0700
commitb7e9713ee3313415ba4ac7322405fef89befdfda (patch)
tree615af6528be304f32ab66ea0d1e6d4a98d25d214 /mysql-test
parent2ea5096cecbfd3cafd988d6f7bef1f1939a25082 (diff)
downloadmariadb-git-b7e9713ee3313415ba4ac7322405fef89befdfda.tar.gz
Fixed LP bug #819716.
Do not optimize derived table for the second time ever.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/derived_view.result15
-rw-r--r--mysql-test/r/subselect_sj.result2
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result2
-rw-r--r--mysql-test/t/derived_view.test11
4 files changed, 28 insertions, 2 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index 4e9d979804b..3608af854ba 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -1200,4 +1200,19 @@ Warnings:
Note 1003 select `v2`.`b` AS `b` from `test`.`v2` where 0
DROP VIEW v1,v2;
DROP TABLE t1;
+#
+# LP bug #819716: crash with embedded tableless materialized derived
+# with a variable
+#
+set optimizer_switch='derived_merge=off';
+EXPLAIN
+SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED <derived3> system NULL NULL NULL NULL 1
+3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
+@b
+NULL
+set optimizer_switch=@exit_optimizer_switch;
set optimizer_switch=@exit_optimizer_switch;
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index b769a6e3441..517b6e63c6d 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -1284,7 +1284,7 @@ SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY <derived3> system NULL NULL NULL NULL 1
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
a a
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index fd45c86b2e1..cc83b9ac99c 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -1295,7 +1295,7 @@ SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY <derived3> system NULL NULL NULL NULL 1
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
a a
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 41cf1444926..48df49226a4 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -726,5 +726,16 @@ SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b;
DROP VIEW v1,v2;
DROP TABLE t1;
+--echo #
+--echo # LP bug #819716: crash with embedded tableless materialized derived
+--echo # with a variable
+--echo #
+
+set optimizer_switch='derived_merge=off';
+EXPLAIN
+SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
+SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
+set optimizer_switch=@exit_optimizer_switch;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;