Bug #8762 Stored Procedures: Inconsistent behavior of DROP PROCEDURE IF EXISTS statement.
Submitted: 24 Feb 2005 0:32 Modified: 3 Mar 2005 10:38
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2 OS:Linux (Linux RedHat 9.0)
Assigned to: Bugs System CPU Architecture:Any

[24 Feb 2005 0:32] Disha
Description:
If DROP PROCEDURE IF EXISTS statement is run as a part of a compound statement, the command executes successfully only if the procedure does not exist.

How to repeat:
Test Setup 
1. Start a fresh client connection to a mysql server.
2. Create database say 'Test'
3. Use 'Test'
4. Create table t1( f1 char );

Repro Steps
Run the following SQL queries:

1. Delimiter //;
2. Drop procedure if exists sp1;
   Create procedure sp1() select * from T1//
3. Drop procedure if exists sp1;
   Create procedure sp1() select * from T1//

Expected Result
The 3rd SQL query should run successfully without any problems.

Actual Results:

    mysql> Delimiter //;
    mysql>  Drop procedure if exists sp1;
        ->  Create procedure sp1() select * from T1//
    Query OK, 0 rows affected, 1 warning (0.00 sec)

    Query OK, 0 rows affected (0.00 sec)

    mysql>  Drop procedure if exists sp1;
        ->  Create procedure sp1() select * from T1//

    Query OK, 0 rows affected (0.00 sec)

After running the 3rd query the mysql client stops responding.
[24 Feb 2005 9:13] MySQL Verification Team
Verified with latest 5.0 BK tree
[24 Feb 2005 9:35] Disha
Updated the synopsis.