| Bug #1635 | Problem inserting date with null values (SQL) | ||
|---|---|---|---|
| Submitted: | 23 Oct 2003 3:39 | Modified: | 23 Oct 2003 6:50 |
| Reporter: | Sébastien Vanvelthem | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S1 (Critical) |
| Version: | 4.0.16 | OS: | Linux (Linux RH9) |
| Assigned to: | CPU Architecture: | Any | |
[23 Oct 2003 4:59]
Sébastien Vanvelthem
The same happens when I make a
insert into news(title_3, text_3, date_maj_3, date_maj_1) values ('ddd', 'lk',
'2003-10-23 12:00:14', NULL);
date_maj_1 is always = 'NOW' and is never NULL.
Why I've created the column nullable and it's default is NULL... Only happens to this fields (date_maj_2, date_maj_3, date_maj_4 works perfectly).
A 'show columns from news' reports date_maj_1 NULLABLE with default : 'NULL' for all columns (except for primary key)
[23 Oct 2003 5:01]
Sébastien Vanvelthem
even 'NOW' when I make insert into news(date_maj_1) values (NULL); -> date_maj_1 = NOW()
[23 Oct 2003 6:50]
Alexander Keremidarski
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php This is exactly how TIMESTAMP should work. Please read manual before reporting bugs.

Description: Hello, my first bug report here... When inserting a record with one timestamp in a table which contains 4 fields defined as NULLABLE timestamps. The first of them is always set to 'NOW'. example News -> field 1 : id_news bigint autoincrement -> field 2 : varchar(80) -> field 3 : date_maj_1 timestamp(14) NULL -> field 4 : date_maj_2 timestamp(14) NULL -> field 5 : date_maj_3 timestamp(14) NULL -> field 6 : date_maj_4 timestamp(14) NULL insert into news(title, date_maj_3) values ('ddd', '2003-10-23 12:00:14'); -> date_maj_1 is set to 'NOW' (default for this field is NULL!) Tested under MySQL 4.0.14 too... With PHPMyadmin and with MySQL client... I've tested it for more than 2 hours before sending it (creating/recreating table from myadmin and in console, altering tables to see what happens). I suppose I'm not wrong... but who knows ;) Thanks for your wonderful product... Sébastien How to repeat: CREATE TABLE `news` ( `id_news` bigint(20) unsigned NOT NULL auto_increment, `title_1` varchar(80) default NULL, `title_2` varchar(80) default NULL, `title_3` varchar(80) default NULL, `title_4` varchar(80) default NULL, `text_1` text, `text_2` text, `text_3` text, `text_4` text, `id_user_1` int(10) unsigned default NULL, `id_user_2` int(10) unsigned default NULL, `id_user_3` int(10) unsigned default NULL, `id_user_4` int(10) unsigned default NULL, `date_maj_1` timestamp(14) default NULL, `date_maj_2` timestamp(14) default NULL, `date_maj_3` timestamp(14) default NULL, `date_maj_4` timestamp(14) default NULL, `date_publish` date default NULL, `societes` varchar(255) binary default NULL, PRIMARY KEY (`id_news`) ) TYPE=MyISAM insert into news(title_3, text_3, date_maj_3) values ('ddd', 'lk', '2003-10-23 12:00:14'); select * from news; date_maj_1 is set to NOW() ! Hope this helps... Suggested fix: no idea, sorry