List:Commits« Previous MessageNext Message »
From:kgeorge Date:May 4 2007 7:57am
Subject:bk commit into 5.0 tree (gkodinov:1.2470)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-05-04 10:57:14+03:00, gkodinov@stripped +3 -0
  Merge gkodinov@stripped:/home/bk/mysql-5.0-opt
  into  magare.gmz:/home/kgeorge/mysql/autopush/B27807-5.0-opt
  MERGE: 1.2433.8.1

  mysql-test/r/subselect.result@stripped, 2007-05-04 10:57:13+03:00, gkodinov@stripped +7 -8
    merge to 5.0-opt
    MERGE: 1.185.2.1

  mysql-test/t/subselect.test@stripped, 2007-05-04 10:57:13+03:00, gkodinov@stripped +8 -10
    merge to 5.0-opt
    MERGE: 1.149.1.1

  sql/sql_select.cc@stripped, 2007-05-04 10:54:13+03:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.511.2.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/autopush/B27807-5.0-opt/RESYNC

--- 1.516/sql/sql_select.cc	2007-05-02 09:34:12 +03:00
+++ 1.517/sql/sql_select.cc	2007-05-04 10:54:13 +03:00
@@ -1426,14 +1426,13 @@ JOIN::optimize()
       }
     }
 
-    if (select_lex->uncacheable && !is_top_level_join())
-    {
-      /* If this join belongs to an uncacheable subquery */
-      if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
-	DBUG_RETURN(-1);
-      error= 0;				// Ensure that tmp_join.error= 0
-      restore_tmp();
-    }
+    /* 
+      If this join belongs to an uncacheable subquery save 
+      the original join 
+    */
+    if (select_lex->uncacheable && !is_top_level_join() &&
+        init_save_join_tab())
+      DBUG_RETURN(-1);
   }
 
   error= 0;
@@ -1493,6 +1492,27 @@ JOIN::reinit()
   }
 
   DBUG_RETURN(0);
+}
+
+/**
+   @brief Save the original join layout
+      
+   @details Saves the original join layout so it can be reused in 
+   re-execution and for EXPLAIN.
+             
+   @return Operation status
+   @retval 0      success.
+   @retval 1      error occurred.
+*/
+
+bool
+JOIN::init_save_join_tab()
+{
+  if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
+    return 1;
+  error= 0;				       // Ensure that tmp_join.error= 0
+  restore_tmp();
+  return 0;
 }
 
 

--- 1.188/mysql-test/r/subselect.result	2007-04-27 20:26:45 +03:00
+++ 1.189/mysql-test/r/subselect.result	2007-05-04 10:57:13 +03:00
@@ -4034,4 +4034,11 @@ SUM( (SELECT AVG( (SELECT COUNT(*) FROM 
 FROM t1;
 ERROR HY000: Invalid use of group function
 DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int, KEY (a));
+INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ref	a	a	5	const	1	Using where; Using index
+2	SUBQUERY	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
+DROP TABLE t1;
 End of 5.0 tests.

--- 1.150/mysql-test/t/subselect.test	2007-04-26 11:15:57 +03:00
+++ 1.151/mysql-test/t/subselect.test	2007-05-04 10:57:13 +03:00
@@ -2874,4 +2874,12 @@ FROM t1;
 
 DROP TABLE t1,t2;
 
+#
+# Bug #27807: Server crash when executing subquery with EXPLAIN
+#  
+CREATE TABLE t1 (a int, b int, KEY (a)); 
+INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+DROP TABLE t1;
+
 --echo End of 5.0 tests.
Thread
bk commit into 5.0 tree (gkodinov:1.2470)kgeorge4 May