Bug #83655 MySQL Workbench automatically injects DROP TRIGGER IF EXISTS
Submitted: 2 Nov 2016 19:00 Modified: 23 Jan 2017 19:00
Reporter: Suckie Kock Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.8 build 1228 CE (64bit) OS:Windows (Verion 10 Pro)
Assigned to: CPU Architecture:Any
Tags: back dash automatic code

[2 Nov 2016 19:00] Suckie Kock
Description:
When creating or editing a trigger on a table Workbench automatically adds "DROP TRIGGER IF EXISTS " followed by the schema then trigger name. However it does not wrap the schema and name with back dashes. This means that if the schema or trigger contain any special characters (like "-" dash) in my case the script will fail. 

How to repeat:
Create a database with a dash in the name. Create a table in that database.  Alter the table and try to add a trigger. When you apply the trigger creation will fail.

Suggested fix:
Use back quotes on the DROP TRIGGER IF EXISTS 'schema'.'MyTrigger_BEFORE_INSERT'; line. This is done in all other areas when creating the trigger.
[2 Nov 2016 21:03] MySQL Verification Team
Thank you for the bug report.
[23 Jan 2017 19:00] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.9 release, and here's the changelog entry:

Schema names were not escaped properly in resulting DROP TRIGGER
statements when a trigger was created or edited.

Thank you for the bug report.