Bug #44063 Triggers incorrectly generated when Forward Engineering SQL CREATE Script
Submitted: 3 Apr 2009 7:03 Modified: 31 Jan 2012 7:21
Reporter: Sean Parr Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.30 OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: forward engineer, trigger, workbench

[3 Apr 2009 7:03] Sean Parr
Description:
When using the forward engineering option to generate a SQL CREATE script, the triggers that have been added to tables don't get generated properly.  

There were three tables created that each had one trigger defined.  The SQL CREATE script contains three of the exact same trigger, so only one of the three triggers is really generated and the other two are not generated in the SQL CREATE script at all.

How to repeat:
1)  Create an EER Diagram.
2)  Create several basic tables with columns and indexes in the EER Diagram.
3)  Edit each of the three tables and add a trigger to each of the tables; make sure the trigger is different for all three tables.
4)  File -> Export -> Forward Engineer SQL CREATE Script...
5)  Check the "Generate DROP <object> statements" checkbox and the "Omit schemata qualifiers from output" checkbox.  Create a file to export to in the Output File field and click Next>.
6)  On the next screen, make sure at least the table and trigger sections are checked to be exported and click Next> and then Finish on the last screen.
7)  Open the SQL file that was created and you can see that not all three triggers were added to the SQL file.
[3 Apr 2009 10:56] Valeriy Kravchuk
Thank you for the problem report. Did you use the same name for all your triggers? 

I can't repeat this problem, so can you, please, send .mwb file that demonstrates it?
[3 Apr 2009 16:34] Sean Parr
You were right.  I had the same name for the triggers.  

I had validated the schema, but Validation does not catch this.  There was also no error at the time of creating/saving the trigger, which would have been helpful.  Should this bug report be used to identify the validation problem or should a new bug be created?
[3 Apr 2009 17:37] Valeriy Kravchuk
Yes, it looks like a Validation bug. I'll try to repeat it and will change Synopsis accordingly.
[5 Apr 2009 14:10] Valeriy Kravchuk
Indeed, WB allows to create triggers on different tables with the same name, and even SE's validations do NOT catch this problem.
[5 Apr 2009 14:12] Valeriy Kravchuk
Model with two triggers having the same name

Attachment: triggers.mwb (application/octet-stream, text), 4.49 KiB.

[31 Jan 2012 7:21] Philip Olson
Fixed as of 5.2.38:

Workbench now detects duplicated trigger names while using the
"Model, Validation (MySQL), Validate all" and
"Model, Validation (MySQL), Check integrity" 
sequences.