Bug #44063 Triggers incorrectly generated when Forward Engineering SQL CREATE Script
Submitted: 3 Apr 9:03 Modified: 5 Apr 16:10
Reporter: Sean Parr
Status: Verified
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.30 OS:Microsoft Windows (XP SP2)
Assigned to: Target Version:WB60
Tags: forward engineer, trigger, workbench
Triage: Triaged: D4 (Minor) / R3 (Medium) / E3 (Medium)

[3 Apr 9: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 12: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 18: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 19:37] Valeriy Kravchuk
Yes, it looks like a Validation bug. I'll try to repeat it and will change Synopsis
accordingly.
[5 Apr 16: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 16:12] Valeriy Kravchuk
Model with two triggers having the same name

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