[Commits] Rev 3462: Merge in file:///home/psergey/dev2/5.5-show-explain-r31/

Sergey Petrunya psergey at askmonty.org
Thu Aug 2 16:12:24 EEST 2012


At file:///home/psergey/dev2/5.5-show-explain-r31/

------------------------------------------------------------
revno: 3462 [merge]
revision-id: psergey at askmonty.org-20120802131223-2tm24zmh1vfahg6y
parent: psergey at askmonty.org-20120801115152-qgxtqd0a5vlqrrhx
parent: psergey at askmonty.org-20120802130605-aeu8f5500cq5t5wb
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-show-explain-r31
timestamp: Thu 2012-08-02 17:12:23 +0400
message:
  Merge
modified:
  mysql-test/r/show_explain.result show_explain.result-20110824104040-a8uwts1ie2z0zdo2-1
  mysql-test/t/show_explain.test show_explain.test-20110824104035-fmqsdgk20kffuefn-1
  sql/sql_select.cc              sp1f-sql_select.cc-19700101030959-egb7whpkh76zzvikycs5nsnuviu4fdlb
=== modified file 'mysql-test/r/show_explain.result'
--- a/mysql-test/r/show_explain.result	2012-08-01 11:51:52 +0000
+++ b/mysql-test/r/show_explain.result	2012-08-02 13:12:23 +0000
@@ -1032,5 +1032,18 @@ max(a+b+c)
 279
 set debug_dbug='';
 DROP TABLE t1,t2,t3;
+#
+# MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (8),(9);
+EXPLAIN SELECT * FROM t1 
+WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+2	SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	Using filesort
+DROP TABLE t1,t2;
 # End
 drop table t0;

=== modified file 'mysql-test/t/show_explain.test'
--- a/mysql-test/t/show_explain.test	2012-08-01 11:51:52 +0000
+++ b/mysql-test/t/show_explain.test	2012-08-02 13:12:23 +0000
@@ -1063,5 +1063,19 @@ set debug_dbug='';
 
 DROP TABLE t1,t2,t3;
 
+--echo #
+--echo # MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (8),(9);
+
+EXPLAIN SELECT * FROM t1 
+WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );
+
+DROP TABLE t1,t2;
+
 --echo # End
 drop table t0;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2012-08-01 11:51:52 +0000
+++ b/sql/sql_select.cc	2012-08-02 13:12:23 +0000
@@ -10737,9 +10737,22 @@ void JOIN::cleanup(bool full)
 
     if (full)
     {
+      JOIN_TAB *sort_tab= first_linear_tab(this, WITHOUT_CONST_TABLES);
+      if (pre_sort_join_tab)
+      {
+        if (sort_tab && sort_tab->select == pre_sort_join_tab->select)
+        {
+          pre_sort_join_tab->select= NULL;
+        }
+        else
+          clean_pre_sort_join_tab();
+      }
+
       for (tab= first_linear_tab(this, WITH_CONST_TABLES); tab; 
            tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
+      {
 	tab->cleanup();
+      }
     }
     else
     {
@@ -10761,9 +10774,6 @@ void JOIN::cleanup(bool full)
   */
   if (full)
   {
-    if (pre_sort_join_tab)
-      clean_pre_sort_join_tab();
-
     if (tmp_join)
       tmp_table_param.copy_field= 0;
     group_fields.delete_elements();



More information about the commits mailing list