Bug #95416 | ZERO Date is both NULL and NOT NULL | ||
---|---|---|---|
Submitted: | 20 May 2019 0:33 | Modified: | 20 May 2019 7:00 |
Reporter: | Morgan Tocker | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.7.25,8.0.15, 5.6.44, 5.7.26, 8.0.16 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[20 May 2019 0:33]
Morgan Tocker
[20 May 2019 0:36]
Morgan Tocker
See also this test-case: mysql [localhost:5725] {msandbox} (test) > select a is null, a is not null from t1; +-----------+---------------+ | a is null | a is not null | +-----------+---------------+ | 0 | 1 | +-----------+---------------+ 1 row in set (0.00 sec)
[20 May 2019 5:17]
MySQL Verification Team
Hello Morgan, Thank you for the report and test case. regards, Umesh
[20 May 2019 5:23]
MySQL Verification Team
- Found legacy issue Bug #940 zero date is both null and not null in where clause Leaving it for Dev's to take a call on this, if this is not going to be fixed then maybe document as Morgan suggested? Thank you.
[20 May 2019 6:57]
Tsubasa Tanaka
I found this in documentation. --- For DATE and DATETIME columns that are declared as NOT NULL, you can find the special date '0000-00-00' by using a statement like this: SELECT * FROM tbl_name WHERE date_column IS NULL This is needed to get some ODBC applications to work because ODBC does not support a '0000-00-00' date value. --- https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#operator_is-null
[20 May 2019 7:00]
Morgan Tocker
Thanks Tanaka-san, I read this, but I didn't understand it on first pass :-) This explains that the feature is intended.