Bug #10665 MySQL exits when dropping an existing temporary table in a procedure
Submitted: 16 May 2005 12:01 Modified: 19 May 2005 13:54
Reporter: Giles McArdell Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.4 OS:Windows (Windows/Linux)
Assigned to: Assigned Account CPU Architecture:Any

[16 May 2005 12:01] Giles McArdell
Description:
MySQL exits when dropping/recreating an existing temporary table in a procedure.

The code below cause MySQL to exit when the procedure is called.

If the first 'create table' line is removed MySQL does not exit but the bug reported in Bug 10664 occurs instead.

Basically I`m not having a good day bug work-around wise.

How to repeat:
drop procedure if exists sp_test;
drop table if exists t;
create temporary table t (val int);
delimiter //
create procedure sp_test()
begin
     drop table if exists t;
     create temporary table t (val int);
     insert t (val) values (1);
     truncate t;
end//
delimiter ;

call sp_test();
[16 May 2005 16:28] MySQL Verification Team
Verified with 5.0.6 BK source. This only happens with InnoDB as default
storage engine.
[19 May 2005 13:48] MySQL Verification Team
Duplicate of:

http://bugs.mysql.com/bug.php?id=10285
http://bugs.mysql.com/bug.php?id=9227
[19 May 2005 13:54] Geert Vanderkelen
Just a small extra note not related to the bug.

When using CREATE TEMPORARY TABLE, you best use DROP TEMPORARY TABLE as explained in manual 
  http://dev.mysql.com/doc/mysql/en/drop-table.html