Bug #62153 Wrong sequence of SQL statements for views where routines are called
Submitted: 12 Aug 2011 15:35 Modified: 12 Aug 2011 20:30
Reporter: Dave Power Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Workbench: Administration Severity:S3 (Non-critical)
Version:5.2.34CE OS:Any
Assigned to: CPU Architecture:Any
Tags: Dump routines views

[12 Aug 2011 15:35] Dave Power
The sequence of SQL statements in the dump view is incorrect if you select both routines and views to be dumped.

Routine definition statements are appended to the end of the "view.sql" file, but this causes a problem when applying the "create view" statements if the view makes reference to a function/routine.

How to repeat:
Export a database where there is one of more view definitions which include a reference to a stored function/routine.  Select both dump views and dump Stored procedures option.

Drop the database schema.

Import the database definition.  It will fail during the import on the view definitions where there is a reference to a function as this will not have been defined.

Suggested fix:
Ensure the sequence of output in the view definition is:

1.  Temporary Table definitions for view statements
2.  create statements for routines: Procedures and Functions
3.  Final view definitions
[12 Aug 2011 19:22] MySQL Verification Team
Please check if http://bugs.mysql.com/bug.php?id=60389 for duplicate?. Thanks.
[12 Aug 2011 20:29] Dave Power
Confirm that this appears to be a duplicate of bug 60389.  http://bugs.mysql.com/bug.php?id=60389
[12 Aug 2011 20:30] Dave Power
Change of status.