Bug #36397 Model Integrity Validation (MySQL) does not allow DEFAULT NULL
Submitted: 29 Apr 2008 13:08 Modified: 29 May 2008 0:13
Reporter: Ian Jones Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.21 SE OS:Any
Assigned to: Maksym Yehorov CPU Architecture:Any
Tags: Validation, workbench

[29 Apr 2008 13:08] Ian Jones
Description:
If a table column definition allows NULLs and has been set with a default of NULL, MySQL Workbench complains that the default value for the column in invalid when performing Integrity Validation.

How to repeat:
Create a table in Workbench with a varchar (or otherwise) column that allows nulls, do not enter anything into "default".
Use menu option File -> Export - Forward Engineer SQL CREATE Script...
Should get SQL file with something like below included:

CREATE  TABLE IF NOT EXISTS `mydb`.`table1` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(45) NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;

Back in Workbench, use menu option File -> New to create a brand new model file.
Use menu option File -> Import -> Reverse Engineer MySQL Create Script... to import SQL file just created.
The table is created, "name" column will have default value of "NULL" (without quotes).

Using menu option Model -> Validation (MySQL) - Integrity Validation will result in following warning:
14:03:04 | Invalid default value for column 'name' in table 'table1'.

If you do the export etc again, the syntax for the name column will be correct with a "DEFAULT NULL", which I believe is valid syntax. But Workbench doesn't validate it properly even though it created it, and allows import of tables with the syntax.

Suggested fix:
Allow for "DEFAULT NULL" in table column when validating a column that allows NULLs.
[29 Apr 2008 14:34] MySQL Verification Team
Thank you for the bug report.
[8 May 2008 11:07] Maksym Yehorov
Fixed for 5.0 and 5.1
[21 May 2008 17:05] Johannes Taxacher
validation now correctly detectes NULL now. (tested in bzr rev 3106)
[29 May 2008 0:07] Paul DuBois
Noted in 5.0.22 changelog.

If a table column definition allows NULL and has been set with a
default of NULL, integrity validation operations complained that the
default value for the column is invalid.