Bug #7308 ISO8601 dates are no longer accepted by MySQL
Submitted: 15 Dec 2004 7:10 Modified: 8 Aug 2005 12:41
Reporter: Dmitry Lenev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8 OS:Any (Any)
Assigned to: Jim Winstead CPU Architecture:Any

[15 Dec 2004 7:10] Dmitry Lenev
Description:
Dates in ISO8601 format are no longer accepted in contexts where datetime value is expected. They were accepted in 4.0. (And judjing from the code this is error rather than
by intention.)

How to repeat:
In 4.0:

mysql> select version();
+--------------+
| version()    |
+--------------+
| 4.0.23-debug |
+--------------+
1 row in set (0.01 sec)

mysql> create table t1 (dt datetime);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values ('20040101T010101');
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+---------------------+
| dt                  |
+---------------------+
| 2004-01-01 01:01:01 |
+---------------------+
1 row in set (0.00 sec)
-------------------------------------------------------------

In 4.1:

mysql> select version();
+-------------+
| version()   |
+-------------+
| 4.1.8-debug |
+-------------+
1 row in set (0.11 sec)

mysql> create table t1 (dt datetime);
Query OK, 0 rows affected (0.12 sec)

mysql> insert into t1 values ('20040101T010101');
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+-------------------------------------------------------+
| Level   | Code | Message                                               |
+---------+------+-------------------------------------------------------+
| Warning | 1264 | Data truncated; out of range for column 'dt' at row 1 |
+---------+------+-------------------------------------------------------+
1 row in set (0.01 sec)

mysql> select * from t1;
+---------------------+
| dt                  |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+
1 row in set (0.07 sec)
[3 Jun 2005 1:27] Jim Winstead
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25548
[2 Aug 2005 18:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27805
[4 Aug 2005 23:47] Jim Winstead
Fixed in 4.1.14 and 5.0.12.
[7 Aug 2005 2:07] Mike Hillyer
Documented in 4.1.14 and 5.0.12 changelogs:

<listitem><para>
 <literal>ISO-8601</literal> formatted dates were not being parsed correctly. (Bug #7308)
</para></listitem>