Bug #39148 constraint foreign key without name but with quotes
Submitted: 1 Sep 2008 7:02 Modified: 12 May 2009 12:20
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: CPU Architecture:Any

[1 Sep 2008 7:02] Lorenzo Luconi Trombacchi
Description:
If you create a Constraint Foreign key and you don't assing to it a name this is exported as an invalid sql create script:

CONSTRAINT ``
    FOREIGN KEY (`table2` )
    REFERENCES `mydb`.`table2` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION

ERROR 1280 (42000): Incorrect index name ''

But if you remove the quotes when there isn't an index name the sql is valid and you let your MySQL to chose a name for you.
So with a constraint/index name add quotes, without a name remove them. This is bug is not present for standard index only because at present quotes are never been added (see bug #39140).

How to repeat:
Create a table with a constraint and not assign a name to it and try to export as SQL create script.
[1 Sep 2008 11:07] MySQL Verification Team
Thank you for the bug report.
[12 May 2009 12:20] Susanne Ebrecht
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/