Bug #60232 Duplicate column names are allowed
Submitted: 24 Feb 2011 13:44 Modified: 31 Jan 2018 10:15
Reporter: Michael Garcia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.31 CE OS:Any
Assigned to: CPU Architecture:Any

[24 Feb 2011 13:44] Michael Garcia
Description:
Duplicate column names are allowed in mysql workbench.

This occurs for manually named columns and automatically named columns (I wasn't able to reproduce this behavior for automatically named columns, but it happened)

This causes forward engineering to fail, and thus should not be allowed

How to repeat:
1) Create a column
2) Create another column with the same name
3) Nothing happens [an alert dialog should pop up]

Suggested fix:
1) When a column name has the same name as another column in the same table, change the name of the last added column (append a number in the end, for instance) and display an error message.

2) Don't forget to check if the new name isn't also being used! If it is, repeat step 1

3) When automatically generating a name, verify that the name is unique, if it isn't, repeat the steps above until it is.
[24 Feb 2011 13:53] Valeriy Kravchuk
Indeed, not only this is not checked while columns are added, but even when generating SQL there are no checks, and the following code is generated without any warnings:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `idtable1` INT NOT NULL ,
  `c1` VARCHAR(45) NULL ,
  `c2` VARCHAR(45) NULL ,
  `c1` VARCHAR(45) NULL ,
  PRIMARY KEY (`idtable1`) )
ENGINE = InnoDB;
[31 Jan 2018 10:15] Mike Lischke
Posted by developer:
 
This behavior is by design. It must be possible to temporarily have objects with the same name to make renames easily possible. If you want automatic validation of such duplicates before doing a synchronization, you can use the MySQL Workbench Standard Edition (a commercial offering).