This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a INT ZEROFILL);
|
INSERT INTO t1 VALUES (128);
|
SELECT * FROM t1 WHERE a=128;
|
SELECT * FROM t1 WHERE hex(a)='80';
|
correctly returns one row for both SELECT queries.
if I join the two conditions using AND:
SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
|
it unexpectedly returns Empty set.
EXPLAIN for the above query tells "Impossible WHERE":
MariaDB [test]> EXPLAIN SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
|
+------+-------------+-------+------+---------------+------+---------+------+------+------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+------+------------------+
|
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE |
|
+------+-------------+-------+------+---------------+------+---------+------+------+------------------+
|
- blocks
-
MDEV-8728
Fix a number of problems in equal field and equal expression propagation
-
-
Closed
{"report":{"fcp":908.2000000476837,"ttfb":230.89999985694885,"pageVisibility":"visible","entityId":51952,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"22932890-1926-4961-ac86-07b6822dd5f5","navigationType":0,"readyForUser":981.3999998569489,"redirectCount":0,"resourceLoadedEnd":1035.2999999523163,"resourceLoadedStart":236.70000004768372,"resourceTiming":[{"duration":138.39999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":236.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":375.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":138.60000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":236.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":375.5,"responseStart":0,"secureConnectionStart":0},{"duration":147.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":237.09999990463257,"connectEnd":237.09999990463257,"connectStart":237.09999990463257,"domainLookupEnd":237.09999990463257,"domainLookupStart":237.09999990463257,"fetchStart":237.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":237.09999990463257,"responseEnd":384.7000000476837,"responseStart":384.7000000476837,"secureConnectionStart":237.09999990463257},{"duration":220,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":237.29999995231628,"connectEnd":237.29999995231628,"connectStart":237.29999995231628,"domainLookupEnd":237.29999995231628,"domainLookupStart":237.29999995231628,"fetchStart":237.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":237.29999995231628,"responseEnd":457.2999999523163,"responseStart":457.2999999523163,"secureConnectionStart":237.29999995231628},{"duration":224.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":237.39999985694885,"connectEnd":237.39999985694885,"connectStart":237.39999985694885,"domainLookupEnd":237.39999985694885,"domainLookupStart":237.39999985694885,"fetchStart":237.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":237.39999985694885,"responseEnd":462,"responseStart":462,"secureConnectionStart":237.39999985694885},{"duration":224.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":237.70000004768372,"connectEnd":237.70000004768372,"connectStart":237.70000004768372,"domainLookupEnd":237.70000004768372,"domainLookupStart":237.70000004768372,"fetchStart":237.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":237.70000004768372,"responseEnd":462.5,"responseStart":462.5,"secureConnectionStart":237.70000004768372},{"duration":225,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":237.79999995231628,"connectEnd":237.79999995231628,"connectStart":237.79999995231628,"domainLookupEnd":237.79999995231628,"domainLookupStart":237.79999995231628,"fetchStart":237.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":237.79999995231628,"responseEnd":462.7999999523163,"responseStart":462.7999999523163,"secureConnectionStart":237.79999995231628},{"duration":288.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":238.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":527,"responseStart":0,"secureConnectionStart":0},{"duration":225.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":238.20000004768372,"connectEnd":238.20000004768372,"connectStart":238.20000004768372,"domainLookupEnd":238.20000004768372,"domainLookupStart":238.20000004768372,"fetchStart":238.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":238.20000004768372,"responseEnd":463.2999999523163,"responseStart":463.2999999523163,"secureConnectionStart":238.20000004768372},{"duration":288.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":238.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":238.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":527.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":225.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":238.5,"connectEnd":238.5,"connectStart":238.5,"domainLookupEnd":238.5,"domainLookupStart":238.5,"fetchStart":238.5,"redirectEnd":0,"redirectStart":0,"requestStart":238.5,"responseEnd":463.7999999523163,"responseStart":463.7999999523163,"secureConnectionStart":238.5},{"duration":446.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":239.39999985694885,"connectEnd":239.39999985694885,"connectStart":239.39999985694885,"domainLookupEnd":239.39999985694885,"domainLookupStart":239.39999985694885,"fetchStart":239.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":239.39999985694885,"responseEnd":686,"responseStart":686,"secureConnectionStart":239.39999985694885},{"duration":739.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":239.5,"connectEnd":239.5,"connectStart":239.5,"domainLookupEnd":239.5,"domainLookupStart":239.5,"fetchStart":239.5,"redirectEnd":0,"redirectStart":0,"requestStart":239.5,"responseEnd":978.5999999046326,"responseStart":978.5999999046326,"secureConnectionStart":239.5},{"duration":148,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":538.3999998569489,"connectEnd":538.3999998569489,"connectStart":538.3999998569489,"domainLookupEnd":538.3999998569489,"domainLookupStart":538.3999998569489,"fetchStart":538.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":538.3999998569489,"responseEnd":686.3999998569489,"responseStart":686.3999998569489,"secureConnectionStart":538.3999998569489},{"duration":226.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":808.8999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":808.8999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1035.2999999523163,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":57,"responseStart":231,"responseEnd":234,"domLoading":235,"domInteractive":1036,"domContentLoadedEventStart":1036,"domContentLoadedEventEnd":1081,"domComplete":1376,"loadEventStart":1376,"loadEventEnd":1376,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1017.2999999523163},{"name":"bigPipe.sidebar-id.end","time":1018},{"name":"bigPipe.activity-panel-pipe-id.start","time":1018.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1020.7999999523163},{"name":"activityTabFullyLoaded","time":1108.8999998569489}],"measures":[],"correlationId":"f7589506f1a95d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
explain extended SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
show warnings;
+-------+------+--------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------+
| Note | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 |
+-------+------+--------------------------------------------------------+
and without zerofil
explain extended SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
+-------+------+------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------------------------------------------------+
| Note | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 128) |
+-------+------+------------------------------------------------------------------------------+