Bug #55051 Validation check: message table has no PK
Submitted: 7 Jul 2010 11:37 Modified: 7 Feb 2014 8:14
Reporter: Susanne Ebrecht Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[7 Jul 2010 11:37] Susanne Ebrecht
Description:
On MySQL CLI:

DROP SCHEMA IF EXISTS testwbvalidation;
CREATE SCHEMA testwbvalidation;
USE testwbvalidation;

CREATE TABLE t(i SERIAL, j INTEGER, v VARCHAR(100))ENGINE=INNODB;

Consider:
Data type serial will generate NOT NULL constraint and a UNIQUE INDEX for the column.

Workbench:

CREATE MODEL FROM EXISTING DATABASE
Choose schema testwbvalidation

Model -> Validation -> Validate ALL

Result:
Warning: Table 't' has no primary key

According to 3NF and innodb tables don't need to have a unique index named primary key. It is enough that there is a unique index and not null constraint.

It would be better when you would not check here if there is a unique key named 'primary key'. When you would check instead if there is a unique index (doesn't matter which name) and not null constraint on the table doesn't matter which name 

How to repeat:
see above

Suggested fix:
see above
[7 Feb 2014 8:14] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.1.2 release, and here's the changelog entry:

While creating a column with the "serial" data type generates a NOT NULL
constraint with a UNIQUE INDEX for the column, MySQL Workbench would complain
about a missing Primary Key.

Thank you for the bug report.