Bug #2790 Dropping function leads to packet error in stored procedures
Submitted: 14 Feb 2004 5:19 Modified: 23 Mar 2004 8:30
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.0-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Bugs System CPU Architecture:Any

[14 Feb 2004 5:19] Peter Gulutzan
Description:
A procedure can depend on a function. If the function doesn't exist, CREATE PROCEDURE 
won't work. But I can create the function, create the procedure, drop the function, and then 
try to use the procedure -- causing "Packets out of order" errors. 
  

How to repeat:
mysql> create function f () returns int return 5; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create procedure p () select f(); 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> drop function f restrict; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> show create procedure p; 
ERROR 1064 (42000): You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use near 'select f()' at line 
2 
mysql> show create procedure p; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query 
 

Suggested fix:
[23 Mar 2004 8:30] 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
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

This is no longer repeatable.
(Most likely fixed when the way function calls are parsed was changed.)