Bug #10285 DROP TABLE IF EXISTS in a stored procedure fails if the table does not exist
Submitted: 1 May 2005 0:07 Modified: 1 May 2005 2:59
Reporter: David Smith Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.4-beta-nt OS:Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[1 May 2005 0:07] David Smith
Description:
Using DROP TABLE IF EXISTS in a stored procedure fails with error  1146 if the table does not exist.

How to repeat:
Repeat the following on using a freshly created database (called xyzzy in this example):

mysql> DELIMITER //
mysql> CREATE PROCEDURE pp()
    -> BEGIN
    ->
    -> DROP TABLE IF EXISTS t;
    -> CREATE TEMPORARY TABLE t (a INT) ENGINE = MEMORY;
    -> INSERT INTO t VALUES (1);
    ->
    -> END;
    -> //
Query OK, 0 rows affected (0.01 sec)

mysql> DELIMITER ;
mysql> CALL pp();
ERROR 1146 (42S02): Table 'xyzzy.t' doesn't exist
mysql>
[1 May 2005 2:59] MySQL Verification Team
Duplicate of:

http://bugs.mysql.com/bug.php?id=9227