Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Component/s:
None
Due to the fix for MDEV-4817 , the ancient bugfeature related to DATE/DATETIME and IS NULL stopped working.
Here is the story: http://bugs.mysql.com/bug.php?id=940
Here is the doc: http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html
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.
Here is how it looks:
CREATE TABLE t1 (id INT , d DATE NOT NULL );
INSERT INTO t1 VALUES (1, '0000-00-00' ),(2, '0000-00-00' );
SELECT * FROM t1 WHERE d IS NULL ;
# + ------+------------+
# | id | d |
# + ------+------------+
# | 1 | 0000-00-00 |
# | 2 | 0000-00-00 |
# + ------+------------+
# 2 rows in set (0.01 sec)
But it doesn't work any longer for scenarios affected by MDEV-4817 fix:
CREATE TABLE t1 (id INT , d DATE NOT NULL );
INSERT INTO t1 VALUES (1, '0000-00-00' ),(2, '0000-00-00' );
CREATE TABLE t2 (i INT );
SELECT * FROM t1 LEFT JOIN t2 ON (id=i) WHERE NULL OR d IS NULL ;
# Empty set (0.01 sec)
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON (id=i) WHERE NULL OR d IS NULL;
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
| 1 | SIMPLE | t2 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | |
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 2 | 100.00 | Using where; Using join buffer (flat, BNL join) |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------------------------------------------+
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Note | 1003 | select `test`.`t1`.`id` AS `id`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`id` = `test`.`t2`.`i`) and (`test`.`t1`.`d` = 0)) |
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
{"report":{"fcp":727.0999999046326,"ttfb":181.40000009536743,"pageVisibility":"visible","entityId":25017,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"415f7796-3e1c-4979-90ce-1cb8042755c2","navigationType":0,"readyForUser":790.2999999523163,"redirectCount":0,"resourceLoadedEnd":728.7000000476837,"resourceLoadedStart":187.59999990463257,"resourceTiming":[{"duration":12.900000095367432,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":187.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":187.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":200.5,"responseStart":0,"secureConnectionStart":0},{"duration":14.199999809265137,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":187.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":187.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":202.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":64.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":188,"connectEnd":188,"connectStart":188,"domainLookupEnd":188,"domainLookupStart":188,"fetchStart":188,"redirectEnd":0,"redirectStart":0,"requestStart":188,"responseEnd":252.40000009536743,"responseStart":252.40000009536743,"secureConnectionStart":188},{"duration":125.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":188.09999990463257,"connectEnd":188.09999990463257,"connectStart":188.09999990463257,"domainLookupEnd":188.09999990463257,"domainLookupStart":188.09999990463257,"fetchStart":188.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":188.09999990463257,"responseEnd":313.59999990463257,"responseStart":313.59999990463257,"secureConnectionStart":188.09999990463257},{"duration":129.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":188.20000004768372,"connectEnd":188.20000004768372,"connectStart":188.20000004768372,"domainLookupEnd":188.20000004768372,"domainLookupStart":188.20000004768372,"fetchStart":188.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":188.20000004768372,"responseEnd":317.59999990463257,"responseStart":317.59999990463257,"secureConnectionStart":188.20000004768372},{"duration":131,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":188.29999995231628,"connectEnd":188.29999995231628,"connectStart":188.29999995231628,"domainLookupEnd":188.29999995231628,"domainLookupStart":188.29999995231628,"fetchStart":188.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":188.29999995231628,"responseEnd":319.2999999523163,"responseStart":319.2000000476837,"secureConnectionStart":188.29999995231628},{"duration":132,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":188.40000009536743,"connectEnd":188.40000009536743,"connectStart":188.40000009536743,"domainLookupEnd":188.40000009536743,"domainLookupStart":188.40000009536743,"fetchStart":188.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":188.40000009536743,"responseEnd":320.40000009536743,"responseStart":320.40000009536743,"secureConnectionStart":188.40000009536743},{"duration":133.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":188.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":188.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":322.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":133,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":188.59999990463257,"connectEnd":188.59999990463257,"connectStart":188.59999990463257,"domainLookupEnd":188.59999990463257,"domainLookupStart":188.59999990463257,"fetchStart":188.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":188.59999990463257,"responseEnd":321.59999990463257,"responseStart":321.59999990463257,"secureConnectionStart":188.59999990463257},{"duration":134.60000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":188.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":188.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":323.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":134.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":188.79999995231628,"connectEnd":188.79999995231628,"connectStart":188.79999995231628,"domainLookupEnd":188.79999995231628,"domainLookupStart":188.79999995231628,"fetchStart":188.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":188.79999995231628,"responseEnd":323.2000000476837,"responseStart":323.2000000476837,"secureConnectionStart":188.79999995231628},{"duration":291.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":190.29999995231628,"connectEnd":190.29999995231628,"connectStart":190.29999995231628,"domainLookupEnd":190.29999995231628,"domainLookupStart":190.29999995231628,"fetchStart":190.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":190.29999995231628,"responseEnd":481.40000009536743,"responseStart":481.2999999523163,"secureConnectionStart":190.29999995231628},{"duration":455,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":190.40000009536743,"connectEnd":190.40000009536743,"connectStart":190.40000009536743,"domainLookupEnd":190.40000009536743,"domainLookupStart":190.40000009536743,"fetchStart":190.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":190.40000009536743,"responseEnd":645.4000000953674,"responseStart":645.4000000953674,"secureConnectionStart":190.40000009536743},{"duration":153.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":483.40000009536743,"connectEnd":483.40000009536743,"connectStart":483.40000009536743,"domainLookupEnd":483.40000009536743,"domainLookupStart":483.40000009536743,"fetchStart":483.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":483.40000009536743,"responseEnd":636.9000000953674,"responseStart":636.9000000953674,"secureConnectionStart":483.40000009536743},{"duration":30.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":696.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":696.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":727.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":16,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&slack-enabled=true","startTime":712.7000000476837,"connectEnd":712.7000000476837,"connectStart":712.7000000476837,"domainLookupEnd":712.7000000476837,"domainLookupStart":712.7000000476837,"fetchStart":712.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":712.7000000476837,"responseEnd":728.7000000476837,"responseStart":728.7000000476837,"secureConnectionStart":712.7000000476837}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":15,"responseStart":181,"responseEnd":185,"domLoading":185,"domInteractive":854,"domContentLoadedEventStart":854,"domContentLoadedEventEnd":888,"domComplete":1309,"loadEventStart":1309,"loadEventEnd":1309,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":831.2999999523163},{"name":"bigPipe.sidebar-id.end","time":832.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":832.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":834.7000000476837},{"name":"activityTabFullyLoaded","time":899.0999999046326}],"measures":[],"correlationId":"e4e2a7753ef418","effectiveType":"4g","downlink":9.5,"rtt":0,"serverDuration":111,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}