Bug #27793 RENAME PROCEDURE / FUNCTION and ALTER PROCEDURE / FUNCTION ... RENAME
Submitted: 12 Apr 2007 21:02 Modified: 4 Mar 2009 14:36
Reporter: Ondra Zizka Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: alter, FUNCTION, PROCEDURE, rename
Triage: D5 (Feature request)

[12 Apr 2007 21:02] Ondra Zizka
Description:
I would appreciate a possibility to rename stored procedure / function other way than dropping it and creating new with other name. So let it be:

RENAME { PROCEDURE | FUNCTION } sp_name [TO] sp_new_name;

and eventually

ALTER { PROCEDURE | FUNCTION } sp_name RENAME [TO] sp_new_name;

Thanks

How to repeat:
N/A

Suggested fix:
...
[4 Mar 2009 9:51] Sveta Smirnova
Thank you for the reasonable feature request.
[4 Mar 2009 9:56] Sveta Smirnova
Local versions of our user manual (French, for example) contains next syntax:

ALTER PROCEDURE | FUNCTION sp_name [characteristic ...]

characteristic:
    NAME newname
  | SQL SECURITY {DEFINER | INVOKER}
  | COMMENT string

(http://dev.mysql.com/doc/refman/5.0/fr/alter-procedure.html)

So it seems this feature was implemented some time ago.
[4 Mar 2009 14:36] Ondra Zizka
Was... and is not.

DROP PROCEDURE IF EXISTS `test`.`TestProc`;
CREATE PROCEDURE `test`.`TestProc` () BEGIN END;
ALTER PROCEDURE TestProc NAME = TestProc2;

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 'NAME = TestProc2' at line 1
[30 May 2012 17:05] Denis TRUFFAUT
I confirm that the feature is not working (MySQL 5.6.4-m7-log)

(
mysql -u myuser -pmypassword -D mybase -e "
DELIMITER |

DROP PROCEDURE IF EXISTS toto|
DROP PROCEDURE IF EXISTS titi|

CREATE PROCEDURE toto ()
BEGIN
END|

ALTER PROCEDURE toto NAME 'titi' |

CALL titi()|

DROP PROCEDURE IF EXISTS toto|
DROP PROCEDURE IF EXISTS titi|

DELIMITER ;
"
)

ERROR 1064 (42000) at line 11: 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 'NAME 'titi'' at line 1