WL#6030: The BEFORE triggers are not processed for NOT NULL columns

Affects: Server-5.7   —   Status: Complete

This WorkLog originated from BUG#6295 (TRIGGERS ARE NOT PROCESSED
FOR NOT NULL COLUMNS).

The problem is that if a column is declared as NOT NULL, it is not
possible to do INSERT NULL (or UPDATE to NULL) even though
there is associated trigger, setting NOT-NULL value.

For example:

  - Table 't1' with a NOT NULL column 'c1';

  - The table has BEFORE INSERT trigger which sets the 'c1' column
    to not null value (SET NEW.c1 = 1);

  - INSERT INTO t1 VALUES(NULL)
    or
    UPDATE t1 SET c1 = NULL
    fail with the following error:
    ERROR 1048 (23000): Column '' cannot be null 

The cause for the current (wrong) behavior is that the column constraints
are checked before triggers are executed. 

This is against The Standard, which requires that column constraints 
are checked at the end of an SQL statement.