Bug #85245 Failure to create new database with view using a user-defined function
Submitted: 1 Mar 2017 8:24 Modified: 1 Mar 2017 8:45
Reporter: A S Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:6.3.9 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql model, synchronize model, View with User-Defined Function

[1 Mar 2017 8:24] A S
Description:
When you try to create a database that includes:

1. a user-defined function (e.g., id_to_name) AND
2. a view (e.g., nameview) that makes use of this user-defined function

then "Synchronize Model" to create a new database fails with the following error:

ERROR: Error 1305: FUNCTION mydb.id_to_name does not exist
SQL Code:
        CREATE  OR REPLACE VIEW `nameview` AS
        select id, name, id_to_name(id) from nametable

How to repeat:
I've attached a minimal model that shows the symptoms.

Suggested fix:
If the generated SQL would contain dummy function definitions (having the correct arguments and return type but returning a dummy value) would be included between table definition and view generation statements, then this problem could be solved.
[1 Mar 2017 8:24] A S
Minimum database model showing the problem

Attachment: mydb.mwb (application/octet-stream, text), 6.24 KiB.

[1 Mar 2017 8:45] MySQL Verification Team
Hello!

Thank you for the report.
Verified as described.

Thanks,
Umesh