Bug #95462 | Data comparison broke in MySQL 8.0.16 | ||
---|---|---|---|
Submitted: | 21 May 2019 18:42 | Modified: | 25 Jul 2019 11:07 |
Reporter: | Raman Haran | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | regression |
[21 May 2019 18:42]
Raman Haran
[22 May 2019 5:49]
MySQL Verification Team
Hello Raman, Thank you for the report and test case. regards, Umesh
[25 Jul 2019 11:07]
Erlend Dahl
This is intended behaviour, see Bug#93513 Unexpected behaviour for date comparison with constant strings
[4 Jun 2020 19:58]
Miguel Juarez
Upgraded our DB to 8 from 5.7 WHERE/IF sentences as the following should still be allowed to run: SELECT * FROM foo WHERE IF(''='', true, datecolumn <= '') The new version should at least have a setting to allow older queries to run. Is there such a setting? ALLOW_INVALID_DATES does not seem to help.
[6 Feb 2023 18:59]
Zhaozhi Gao
I don't believe the specific case of comparing date/time to '' empty string is the same as the broader scenario described in these report: (i.e. comparing date time to quoted string literal or out of range dates) https://bugs.mysql.com/bug.php?id=93513 https://bugs.mysql.com/bug.php?id=95466 On the server ZERO_DATE is ALLOWED, MySql server has no trouble converting '' string to a date (non-NULL value returned by STR_TO_DATE) Query SELECT STR_TO_DATE('','%Y-%m-%d') Output 0000-00-00 If the STR_TO_DATE function does NOT return NULL, then the system should not throw an error if we 'ALLOW_INVALID_DATES' and DON'T have [NO_ZERO_IN_DATE,NO_ZERO_DATE]. Clearly the conversion of '' (empty string) resulted in a valid '0000-00-00' date in system where the correct sql mode is set. There is no reason to break this backward compatibility.