Bug #7308 ISO8601 dates are no longer accepted by MySQL
Submitted: 15 Dec 2004 8:10 Modified: 8 Aug 2005 14:41
Reporter: Dmitri Lenev
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.1.8 OS:Any (Any)
Assigned to: Jim Winstead Target Version:

[15 Dec 2004 8:10] Dmitri 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 3: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 20: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
[5 Aug 2005 1:47] Jim Winstead
Fixed in 4.1.14 and 5.0.12.
[7 Aug 2005 4: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>