Bug #39751 | Insertting NULL value in Timestamp data type having default value | ||
---|---|---|---|
Submitted: | 30 Sep 2008 9:50 | Modified: | 30 Sep 2008 21:10 |
Reporter: | Vinod Sugur | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 6.0.6-alpha-community | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | DEFAULT CURRENT_TIMESTAMP |
[30 Sep 2008 9:50]
Vinod Sugur
[30 Sep 2008 11:00]
Vinod Sugur
The table description shows that column ts created with NOT NULL constraint. mysql> desc test; +-------+-----------+------+-----+-------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-----------+------+-----+-------------------+-------+ | id | int(11) | YES | | NULL | | | ts | timestamp | NO | | CURRENT_TIMESTAMP | | +-------+-----------+------+-----+-------------------+-------+ 2 rows in set (0.00 sec) The fix to this issue would be use NULL while creating table as given below: create table test (id integer, ts timestamp NULL default current_timestamp);
[30 Sep 2008 21:10]
MySQL Verification Team
Thank you for the bug report. Could you please read: http://dev.mysql.com/doc/refman/6.0/en/timestamp.html "TIMESTAMP columns are NOT NULL by default, cannot contain NULL values, and assigning NULL assigns the current timestamp. However, a TIMESTAMP column can be allowed to contain NULL by declaring it with the NULL attribute. In this case, the default value also becomes NULL..."