Bug #39140 Missing quote for index name in forward eng. sql
Submitted: 30 Aug 2008 22:56 Modified: 14 Oct 2008 10:45
Reporter: Lorenzo Luconi Trombacchi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.24 OS:Any
Assigned to: Sergei Tkachenko CPU Architecture:Any

[30 Aug 2008 22:56] Lorenzo Luconi Trombacchi
Description:
Forward Engineer Sql Script Create or Alter, add index defintion without quote for index name.
For example:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `idtable1` INT NOT NULL ,
  `a` INT,
  PRIMARY KEY (`idtable1`) ,
  INDEX index1 (`a` ASC) );

But there isn't any kind of validation for the index name, so you can set an index name as for example INDEX (or any other reserved word), so your creation script looks like this:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `idtable1` INT NOT NULL ,
  `a` INT,
  INDEX INDEX (`a` ASC) );

And this is not a good sql script for my MySQL (at least for 5.1), but this is good:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `idtable1` INT NOT NULL ,
  `a` INT,
  INDEX `INDEX` (`a` ASC) );

How to repeat:
Create a table with at least and index and try to export in sql with forward engineer.
[31 Aug 2008 16:01] Valeriy Kravchuk
Thank you for a bug report. Verified just as described.
[10 Sep 2008 14:22] Johannes Taxacher
this is fixed. Index names are quoted now.
fix will be in 5.0.25
[14 Oct 2008 10:45] Tony Bedford
An entry was added to the 5.0.25 changelog:

Forward Engineer SQL CREATE Script and Forward Engineer SQL ALTER Script generated scripts that did not put index names in quotes.