Bug #30 saving a NULL value into NOT NULL column with a function
Submitted: 14 Jan 2003 14:54 Modified: 28 Jan 2003 16:53
Reporter: Sinisa Milivojevic Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 OS:Any (any)
Assigned to: Michael Widenius CPU Architecture:Any

[14 Jan 2003 14:54] Sinisa Milivojevic
Description:
Sinisa> CREATE TABLE `t` (
Sinisa>   `a` varchar(16) NOT NULL default '',
Sinisa>   `b` smallint(6) NOT NULL default '0',
Sinisa>   `c` datetime NOT NULL default '0000-00-00 00:00:00',
Sinisa>   `d` smallint(6) NOT NULL default '0',
Sinisa> ) TYPE=MyISAM;
Sinisa> INSERT INTO t SET a = "";
Sinisa> UPDATE t SET d=UNIX_TIMESTAMP(DATE_ADD(c, interval (b) day)) / 1;

How to repeat:

Suggested fix:
===== field_conv.cc 1.8 vs edited =====
*** /tmp/field_conv.cc-1.8-4065 Tue Dec  3 13:08:21 2002
--- edited/field_conv.cc        Tue Jan 14 03:32:03 2003
***************
*** 118,123 ****
--- 118,128 ----
      field->reset();
      return 0;
    }
+   if (current_thd->count_cuted_fields)
+   {
+     current_thd->cuted_fields++;              // Increment error counter
+     return 0;
+   }
    return 1;
  }
[28 Jan 2003 16:53] MySQL Developer
Not full bug report, but fixed in 4.0.10