Bug #47456 Forward Engineer generates table definitions with missing closing parenthesis
Submitted: 19 Sep 2009 21:11 Modified: 20 Sep 2009 7:26
Reporter: Chris Kaminski Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.3 Alpha OS:MacOS (10.6.1)
Assigned to: CPU Architecture:Any
Tags: CREATE TABLE, forward engineer, parenthesis, tabledef

[19 Sep 2009 21:11] Chris Kaminski
Description:
The Forward Engineer feature generates the CREATE TABLE syntax and omits the trailing closing parenthesis from each CREATE statement making the syntax invalid.

How to repeat:
1. Create a new Model by choosing "New Model" from the File menu
2. Double Click on "Add Diagram"
3. Create a new Table called "table1"
4. Add two columns: "col1" and "col2" - col1 is of type INT, not null and autonumber. col2 is of type VARCHAR2(45) and is also non-nullable
5. Choose "Forward Engineer..." from the Database menu
6. Leave all options un-checked and click Continue
7. Verify that only the "Export MySQL Table Objects" is checked and click Continue
8. The Script Preview will show the following as part of the code generated:

-- -----------------------------------------------------
-- Table `mydb`.`table1`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `col1` INT NOT NULL AUTO_INCREMENT ,
  `col2` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`col1`) 
ENGINE = InnoDB;

Note the missing ) that should appear at the end of the line starting with "PRIMARY KEY..."

Suggested fix:
Update the syntax generation logic to include the missing parenthesis.
[20 Sep 2009 7:26] Valeriy Kravchuk
Please do not submit the same bug more than once. An existing bug report, Bug #47407, already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.