List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:February 24 2011 12:48pm
Subject:bzr commit into mysql-trunk branch (jon.hauglid:3710) Bug#11748372
View as plain text  
#At file:///export/home/x/mysql-trunk-bug11748372/ based on revid:tor.didriksen@stripped

 3710 Jon Olav Hauglid	2011-02-24
      Bug #11748372 (former 36089)
      DROP TEMP TABLE IN SP CALLED BY FUNCTION, CRASH
      
      The assertion was triggered if a query using a temporary table
      executed a stored routine which caused the table to be dropped
      and replaced with a different table.
      
      This bug is no longer reproduceable on current versions of 
      5.1, 5.5 or trunk. Trying to drop a temporary table used by
      an outer statement will give ER_CANT_REOPEN_TABLE.
      This patch adds a regression test and contains no code changes.

    modified:
      mysql-test/r/temp_table.result
      mysql-test/t/temp_table.test
=== modified file 'mysql-test/r/temp_table.result'
--- a/mysql-test/r/temp_table.result	2010-08-30 06:38:09 +0000
+++ b/mysql-test/r/temp_table.result	2011-02-24 12:48:31 +0000
@@ -223,3 +223,25 @@ CREATE TEMPORARY TABLE bug48067.t1 (c1 i
 DROP DATABASE bug48067;
 DROP TEMPORARY table bug48067.t1;
 End of 5.1 tests
+#
+# Bug #11748372 36089: DROP TEMP TABLE IN SP CALLED BY FUNCTION, CRASH
+#
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a;
+CREATE PROCEDURE p1()
+BEGIN
+DROP TEMPORARY TABLE t1;
+CREATE TEMPORARY TABLE t1 AS SELECT 'abc' AS a;
+END|
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+CALL p1();
+RETURN 1;
+END|
+SELECT 1 FROM t1 HAVING COUNT(*) = f1();
+ERROR HY000: Can't reopen table: 't1'
+DROP FUNCTION f1;
+DROP PROCEDURE p1;
+DROP TEMPORARY TABLE t1;

=== modified file 'mysql-test/t/temp_table.test'
--- a/mysql-test/t/temp_table.test	2010-06-23 11:34:40 +0000
+++ b/mysql-test/t/temp_table.test	2011-02-24 12:48:31 +0000
@@ -251,3 +251,37 @@ DROP DATABASE bug48067;
 DROP TEMPORARY table bug48067.t1;
 
 --echo End of 5.1 tests
+
+
+--echo #
+--echo # Bug #11748372 36089: DROP TEMP TABLE IN SP CALLED BY FUNCTION, CRASH
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a;
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+  DROP TEMPORARY TABLE t1;
+  CREATE TEMPORARY TABLE t1 AS SELECT 'abc' AS a;
+END|
+
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+  CALL p1();
+  RETURN 1;
+END|
+delimiter ;|
+
+--error ER_CANT_REOPEN_TABLE
+SELECT 1 FROM t1 HAVING COUNT(*) = f1();
+
+DROP FUNCTION f1;
+DROP PROCEDURE p1;
+DROP TEMPORARY TABLE t1;


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20110224124831-b7bie5vn5pe23qfq.bundle
Thread
bzr commit into mysql-trunk branch (jon.hauglid:3710) Bug#11748372Jon Olav Hauglid24 Feb