Bug #37685 Trigger auto formatting problems
Submitted: 27 Jun 2008 7:37 Modified: 10 Jul 2008 16:21
Reporter: Jan Juricek Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.0.23 OS:Any
Assigned to: Sergei Tkachenko CPU Architecture:Any
Tags: auto formatting, Dash, trigger

[27 Jun 2008 7:37] Jan Juricek
Description:
When there is a DB schema with a dash in the name, it causes trouble in the USE command of the trigger body.

I'm not so sure why this is a syntax error, since every client I have encountered doesn't require ` in the USE command if there is a dash, but I don't think this is up to me to decide. 

How to repeat:
- Create schema with name including a "-", for example "mydb-foo"
- Create InnoDB table, for example "table1"
- Place the table to some diagram (not exactly required)
- Edit table, open Triggers tab.
- Do nothing and click somewhere to the model so the trigger would be saved.

Now there is a SYNTAX_ERROR_1 produced. It can be fixed by rewriting USE mydb-foo to USE `mydb-foo`. Do it.

- Now close the editation window, reopen Triggers tab and the auto formatting messed up the query again, there are no ` around the db name.
[27 Jun 2008 11:58] MySQL Verification Team
Thank you for the bug report. Duplicate of bug: http://bugs.mysql.com/bug.php?id=36815.
[27 Jun 2008 14:20] Jan Juricek
Thanks for your response. 

I believe this bug report is not a duplicate of #36815:

- the duplicate bugreport is marked as closed and yet the bug still appears in the current version. 
- #36815 describes the error occuring on example of DB schema named "mydb" -> in current version the bug cannot be reproduced
- behavior I am describing appears only when DB schema name contains a dash. 

I have tried folowing: 
1) New schema
2) New table
3) Open Triggers tab
4) Close Triggers tab
5) Validate MySQL

When the DB schema name was 'mydb', no error occured. Then after creating new schema, I have renamed it to 'mydb-foo' and continued by step (2) - Validation reported specified problem.

Please reconsider marking the bug report as a duplicate for I strongly believe it is another issue (Although it may be in the very same functionality).
[27 Jun 2008 16:53] Sergei Tkachenko
Thanks for the bug-report.
Schema name will be quoted, because WB relies on grammar taken from server. Standard MySQL client has its own interpreter for client specific commands, that's why it's possible to omit delimiter & quotation when using it.
Fix will go to v5.0.24.
[30 Jun 2008 16:09] Johannes Taxacher
now USE clause in triggercode is always created using ` for enclosing schema-name. fix will be included in 5.0.24.
[10 Jul 2008 16:21] Tony Bedford
An entry was added to 5.0.22 changelog as per bug #36815.