[Commits] Rev 3146: Fixed LP bug #819716. in file:///home/igor/maria/maria-5.3-bug819716/

Igor Babaev igor at askmonty.org
Tue Aug 9 08:02:10 EEST 2011


At file:///home/igor/maria/maria-5.3-bug819716/

------------------------------------------------------------
revno: 3146
revision-id: igor at askmonty.org-20110809050210-fpt9djersdhxmnn4
parent: psergey at askmonty.org-20110808215708-0scl03fmd96uzsja
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3-bug819716
timestamp: Mon 2011-08-08 22:02:10 -0700
message:
  Fixed LP bug #819716.
  Do not optimize derived table for the second time ever.
-------------- next part --------------
=== modified file 'mysql-test/r/derived_view.result'
--- a/mysql-test/r/derived_view.result	2011-07-21 21:23:08 +0000
+++ b/mysql-test/r/derived_view.result	2011-08-09 05:02:10 +0000
@@ -1200,4 +1200,19 @@
 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;
+ at b
+NULL
+set optimizer_switch=@exit_optimizer_switch;
 set optimizer_switch=@exit_optimizer_switch;

=== modified file 'mysql-test/r/subselect_sj.result'
--- a/mysql-test/r/subselect_sj.result	2011-07-21 15:14:34 +0000
+++ b/mysql-test/r/subselect_sj.result	2011-08-09 05:02:10 +0000
@@ -1284,7 +1284,7 @@
 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

=== modified file 'mysql-test/r/subselect_sj_jcl6.result'
--- a/mysql-test/r/subselect_sj_jcl6.result	2011-07-21 15:14:34 +0000
+++ b/mysql-test/r/subselect_sj_jcl6.result	2011-08-09 05:02:10 +0000
@@ -1295,7 +1295,7 @@
 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

=== modified file 'mysql-test/t/derived_view.test'
--- a/mysql-test/t/derived_view.test	2011-07-21 21:23:08 +0000
+++ b/mysql-test/t/derived_view.test	2011-08-09 05:02:10 +0000
@@ -726,5 +726,16 @@
 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;

=== modified file 'sql/sql_derived.cc'
--- a/sql/sql_derived.cc	2011-07-19 03:05:33 +0000
+++ b/sql/sql_derived.cc	2011-08-09 05:02:10 +0000
@@ -737,7 +737,7 @@
 
   bool res= FALSE;
 
-  if (unit->optimized && !unit->uncacheable && !unit->describe)
+  if (unit->optimized)
     return FALSE;
   lex->current_select= first_select;
 



More information about the commits mailing list