Bug #2614 Sotred procedure with INSERT .. SELECT crash 5t.0
Submitted: 2 Feb 2004 10:02 Modified: 6 Feb 2004 10:56
Reporter: SINISA MILIVOJEVIC Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:Any (any)
Assigned to: CPU Architecture:Any

[2 Feb 2004 10:02] SINISA MILIVOJEVIC
Description:
Stored procedure with INSERT .. from SELECT, that does not contain any tables in 
it will crash MySQL 5.0.

I also discovered that INSERT .. from SELECT, both involving the same table, will 
also crash a server.

How to repeat:
DELIMITER |
DROP PROCEDURE IF EXISTS  crash|
CREATE PROCEDURE crash()
 BEGIN
    DROP TABLE IF EXISTS bug.c1;
    CREATE TABLE bug.c1 (id INT DEFAULT '0' NOT NULL);
    INSERT INTO bug.c1 select 12;
 END|
DELIMITER ;
call crash();
call crash();
DROP TABLE IF EXISTS bug.c1;
DROP PROCEDURE  IF EXISTS crash;

Suggested fix:
I have proposed a fix that first returns a pointer to TABLE_LIST and then
annulls a table pointer within it.

All tests pass.
[2 Feb 2004 10:12] MySQL Verification Team
A fix for the bug was proposed.

When approved, it will find it's way into 5.0.1 release.
[6 Feb 2004 10:56] MySQL Verification Team
A patch is pushed.