Bug #6027 Stored procedures can be renamed
Submitted: 11 Oct 2004 13:13 Modified: 22 Oct 2004 18:36
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Per-Erik Martin CPU Architecture:Any

[11 Oct 2004 13:13] Peter Gulutzan
Description:
I can rename a stored procedure using ALTER PROCEDURE. 
I realize that this behaviour is documented 
http://dev.mysql.com/doc/mysql/en/ALTER_PROCEDURE.html 
but it is not a common, agreed-upon, syntax. 

How to repeat:
mysql> create procedure p1 () begin end; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> alter procedure p1 name p111; 
Query OK, 0 rows affected (0.01 sec)
[11 Oct 2004 14:04] MySQL Verification Team
Verified on latest BK source tree.
[15 Oct 2004 17:34] Andrey Hristov
Well, I have just found that once created in one database a SP cannot be moved to another one by renaming. So, when creating and altering the name of the procedure(function) can be specified with fully qualified with the dbname but when 
renaming the new name is only simple name.

mysql> use test;
Database changed
mysql> delimiter __
mysql> create procedure foo3() begin end;__
Query OK, 0 rows affected (0.02 sec)

mysql> delimiter ;
mysql> alter procedure foo3 name foo4;
Query OK, 0 rows affected (0.03 sec)

mysql> alter procedure foo4 name mysql.foo4;
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 '.foo4' at line 1
[22 Oct 2004 18:36] 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