Bug #7557 | 4.0 - 4.1: comparison with wrong datetime value: behaviour has changed | ||
---|---|---|---|
Submitted: | 28 Dec 2004 14:55 | Modified: | 30 Jun 2007 0:55 |
Reporter: | Alexander Y. Fomichev | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 4.0.x 4.1 | OS: | Linux (linux) |
Assigned to: | Lars Thalmann | CPU Architecture: | Any |
[28 Dec 2004 14:55]
Alexander Y. Fomichev
[28 Dec 2004 19:53]
MySQL Verification Team
This is the expected behavior of 4.1 like displayed in the warning message, however I changed the status to verified for the replication team analyze. mysql> SELECT * FROM t1 WHERE a > '9999-99-99 00:00:00'; Empty set, 1 warning (0.02 sec) mysql> show warnings; +---------+------+-----------------------------------------------------------+ | Level | Code | Message | +---------+------+-----------------------------------------------------------+ | Warning | 1292 | Truncated incorrect datetime value: '9999-99-99 00:00:00' | +---------+------+-----------------------------------------------------------+ 1 row in set (0.00 sec)
[23 Jun 2005 23:25]
Jim Winstead
This happens because Field_datetime:save_in_field() now reports a failure if it the data is invalid, so convert_constant_item() doesn't succeed, and the 'dt' field is compared against the binary string '9999-99-99 etc' instead of a datetime of '0000-00-00 00:00:00'. As Miguel guessed, someone from the replication team needs to take a closer look at this to see if anything could or should be done.
[9 Aug 2005 23:55]
Jim Winstead
The same thing now happens for a date specified with a trailing 'Z' as in the ISO-8601 format. create table t1 (dt datetime); insert into t1 values ('2005-02-16T18:00:00Z'); Warnings: Warning 1264 Data truncated; out of range for column 'dt' at row 1 select * from t1 where dt > '2005-02-16T17:00:00'; dt 2005-02-16 18:00:00 select * from t1 where dt > '2005-02-16T17:00:00Z'; dt Warnings: Warning 1292 Truncated incorrect datetime value: '2005-02-16T17:00:00Z' drop table t1;
[30 Jun 2007 0:55]
Trudy Pelzer
The behaviour change seems to have been intentional; both MySQL 4.0 and 4.1 are past their active-maintenance life cycle. So there will be no change made.