Bug #55483 INSERT tab does not recognize if 'NOT NULL' is set for an attribute.
Submitted: 22 Jul 2010 14:48 Modified: 5 Nov 2014 2:26
Reporter: Adam Kowalewski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.25 OS:Linux (Ubuntu 9.10)
Assigned to: CPU Architecture:Any
Tags: attribute, insert, NOT NULL

[22 Jul 2010 14:48] Adam Kowalewski
Description:
Workbench generates SQL code which try to insert NULL to attributes marked with 'NOT NULL'. 

INSERT tab accept when i create such rows.

How to repeat:
CREATE  TABLE IF NOT EXISTS `mydb`.`a` (
  `ida` INT NOT NULL ,
  `name` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`ida`) )
ENGINE = InnoDB;

(...)

INSERT INTO `mydb`.`a` (`ida`, `name`) VALUES ('1', NULL);
INSERT INTO `mydb`.`a` (`ida`, `name`) VALUES ('2', NULL);

Suggested fix:
Mark such row's with red background color, and show on 'hover' proper message.
[22 Jul 2010 15:01] Adam Kowalewski
Just updated OS description.
[22 Jun 2011 19:37] Alex Z
It's better just to skip any columns with NULLs and don't insert them, so the defaults have a chance to work.
[15 Oct 2014 19:49] Alfredo Kojima
Posted by developer:
 
When generating default INSERTs code for tables in modeling, columns that are specified NOT NULL will replace NULL column values with the DEFAULT keyword.
[5 Nov 2014 2:26] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.2.4 release, and here's the changelog entry:

When generating default INSERTs code for tables in modeling, columns that
are specified NOT NULL will now replace NULL column values with the
DEFAULT keyword.

Thank you for the bug report.