| Bug #21797 | Can`t insert or update fields datetime setting null with null | ||
|---|---|---|---|
| Submitted: | 23 Aug 2006 16:53 | Modified: | 23 Sep 2006 18:06 |
| Reporter: | Alejandro Ferreira | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0 | OS: | Windows (XP) |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
| Tags: | datetime, insert, null | ||
[23 Aug 2006 18:06]
MySQL Verification Team
Thank you for the bug report. Please read: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html and verify which sql_mode you have configured. mysql> desc MyTable\G *************************** 1. row *************************** Field: date_up Type: date Null: YES Key: Default: 0000-00-00 Extra: *************************** 2. row *************************** Field: date_now Type: datetime Null: YES Key: Default: 0000-00-00 00:00:00 Extra: 2 rows in set (0.01 sec) mysql> insert into MyTable values('',''); Query OK, 1 row affected, 2 warnings (0.00 sec) mysql> show warnings; +---------+------+------------------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------------------+ | Warning | 1265 | Data truncated for column 'date_up' at row 1 | | Warning | 1264 | Out of range value adjusted for column 'date_now' at row 1 | +---------+------+------------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> select * from MyTable; +------------+---------------------+ | date_up | date_now | +------------+---------------------+ | 0000-00-00 | 0000-00-00 00:00:00 | +------------+---------------------+ 1 row in set (0.00 sec)
[23 Sep 2006 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: I have a table with a field datetime or date wich allows null. But when I try to insert a row the MySQl say that I have an error, the error is: "Incorrect date value: '' for column 'date_up' at row 1". The table definition of that column is: date_up Date NULL DEFAULT '0000-00-00' Please if you have any solutions to this subject. Tks a lot Alejandro Ferreira How to repeat: Create a simple table Create Table MyTable (date_up Date Null Default '0000-00-00', date_now DateTime Null Default '0000-00-00 00:00:00) type = InnoDB; Now try to insert a row insert into MyTable values('','') And the Server say that is incorrect.