Bug #73006 Procedure Dropped When Altered by User Different than its Creator
Submitted: 14 Jun 2014 5:02 Modified: 15 Aug 2014 17:40
Reporter: Jeffrey Fried Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:5.1.73 OS:Linux
Assigned to: CPU Architecture:Any
Tags: failback failed, stored procedure deleted, Super privilege needed

[14 Jun 2014 5:02] Jeffrey Fried
Description:
Attempt to alter an existing stored procedure without having Super privilege leads to following error messages:

ERROR 1227: Access denied; you need the SUPER privilege for this operation
SQL Statement:
CREATE DEFINER=`chatso`@`localhost` PROCEDURE `Test`(argname varchar(25))
    NO SQL
select * from Members where username like concat(argname, '%');

ERROR: Error when running failback script. Details follow.

ERROR 1227: Access denied; you need the SUPER privilege for this operation
SQL Statement:
CREATE DEFINER=`chatso`@`localhost` PROCEDURE `Test`()
    NO SQL
select * from Members where username like 'crone%'

The error message suggests that the server first dropped the current version of the stored procedure, then attempting to create the new one.  It failed because of lack of privilege but so did the failback attempting to create the dropped version of the stored procedure for the same reason leading to the result that the stored procedure is deleted from the server.

How to repeat:
This bug was repeated on both phpMyAdmin version 4.1.8 running on the server (via web client libmysql version 5.0.96) and from MySQL Workbench version 5.2.47.  The phpMyAdmin user has host = 'localhost', the MySQL Workbench has same username but a remote host

Here's the details:

Create a stored procedure on user@localhost using phpMyAdmin.  Then attempt to alter it on user@remote.host using MySQL Workbench.  You get the error message shown in the description.  Note that both users have SELECT privilege on mysql.procs and SUPER on *.*.
[14 Jun 2014 5:04] Jeffrey Fried
Synopsis shortened to fit available space.  Also updated severity to S2 since data (a stored procedure) is lost.
[14 Jun 2014 5:08] Jeffrey Fried
Forgot to mention that in result of the repro is both the error message shown in the description and that the stored procedure is deleted
[15 Jul 2014 17:40] Sveta Smirnova
Thank you for the report.

I cannot repeat described behavior. Please provide full ALTER statement and output of SHOW GRANTS FOR `chatso`@`localhost`
[16 Aug 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".