Bug #1863 CREATE TABLE in Stored Procedure sometimes crashes on repeated calls.
Submitted: 17 Nov 2003 7:47 Modified: 28 May 2004 14:22
Reporter: Per-Erik Martin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.0 OS:Any (Any)
Assigned to: Bugs System CPU Architecture:Any

[17 Nov 2003 7:47] Per-Erik Martin
Creating a table and using it within a stored PROCEDURE sometime crashes.
A first call might work, but the next call crashes. (It's slightly dependent
on how the table is being use; or just (bad) luck.)

How to repeat:
drop table if exists test1;
create table test1 (content varchar(10) );
insert into test1 values ("test1");
insert into test1 values ("test2");

drop table if exists result_1;
create table result_1 (f1 int, rc int, t3 int);

drop procedure if exists test2;

delimiter |;

create procedure test2(in1 INT)

  DECLARE ind INT default 0;

  declare rc int default 0;
  declare continue handler for 1065 set rc = 1;

  drop table if exists temp_t1;
  create temporary table temp_t1(f1 int auto_increment, f2 varchar(20), primary key (f1));

#This statement leads to crash server 
#in case when this SP one will try to execute once more 
  insert into temp_t1 (f2) select content from test1;

  select f2 into t3 from temp_t1 where f1 = 10;

  if (rc) then
       insert into result_1 values (1, rc, t3);
  end if;

  insert into result_1 values (2, rc, t3);


delimiter ;|

call test2(10);
call test2(10);
[28 May 2004 14:22] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

This appears to have been fixed by other recent bugfixes (probably
the cleanup stuff).