Bug #54066 Editing existing function/stored procedure may be in context of wrong schema
Submitted: 28 May 2010 13:58 Modified: 4 Jul 2010 11:05
Reporter: Yvan Rodrigues Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.21 OS:Windows
Assigned to: CPU Architecture:Any
Tags: DEFAULT, Edit, existing, FUNCTION, schema, stored procedure

[28 May 2010 13:58] Yvan Rodrigues
Description:
When an existing function or stored procedure is edited by selecting it in the Object Browser, right clicking, and choosing Alter Routine..., the script that is presented to be edited is in the context of the currently selected default schema, not the schema to which the routine belongs.

Without manually changing the generated script, the routine will be saved to the default schema, NOT the one to which the routine belongs, causing duplication and confusion.

How to repeat:
- Connect to a server that has multiple schemas.
- Select schema 'foo' as the default.
- Select a function or stored procedure in schema 'bar' and right click and choose Alter routine.
- Note that the name of the procedure in the script editor is locally named, not fully qualified i.e. 
    CREATE DEFINER=`mickey`@`%` PROCEDURE `DoStuff` ...    not
    CREATE DEFINER=`mickey`@`%` PROCEDURE `bar`.`DoStuff` ...  
- Apply
* The routine has been saved to the default schema, not the one you were editing.

Suggested fix:
Either fully qualify the routine name in the editor with the schema name, or precede the script with a USE DATABASE ... command;
[28 May 2010 15:12] Valeriy Kravchuk
I can not repeat this on Mac OS X.
[4 Jun 2010 11:05] Susanne Ebrecht
Many thanks for writing a bug report.

I am not really able to follow you. Do you have a screenshot for us that shows what exactly you are meaning?
[4 Jul 2010 23: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".