Test case:
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (3),(6);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8),(9);
SELECT * FROM t1 LEFT JOIN t2 ON ( a = b ) HAVING a NOT IN ( SELECT 6 ) ORDER BY a ;
DROP TABLE t1, t2;
On current MariaDB 5.1, 5.2, 5.3, MySQL 5.1, 5.5 it returns the wrong result (empty set):
On current MariaDB 5.5, 10.0, MySQL 5.6, 57 it returns the expected result (1 row):
Story:
The bug was introduced in MySQL 5.1 (and merged up) by the following revision:
revno: 4005
revision-id: sergey.glukhov@oracle.com-20130507091058-x4li5jat6pvhop96
parent: annamalai.gurusami@oracle.com-20130506105856-d5il8vpqcovru47g
committer: Sergey Glukhov <sergey.glukhov@oracle.com>
branch nick: mysql-5.1
timestamp: Tue 2013-05-07 13:10:58 +0400
message:
Bug#16095534 CRASH: PREPARED STATEMENT CRASHES IN ITEM_BOOL_FUNC2::FIX_LENGTH_AND_DEC
The problem happened due to broken left expression in Item_in_optimizer object.
In case of the bug left expression is runtime created Item_outer_ref item which
is deleted at the end of the statement and one of Item_in_optimizer arguments
becomes bad when re-executed. The fix is to use real_item() instead of original
left expression. Note: It feels a bit weird that after preparing, the field is
directly part of the generated Item_func_eq, whereas in execution it is replaced
with an Item_outer_ref wrapper object.
Later the bug was fixed in MySQL 5.6 and up by the following revision:
revno: 5849
revision-id: chaithra.gopalareddy@oracle.com-20140228093141-v2sgort4nzof1ydg
parent: georgi.kodinov@oracle.com-20140228084025-kijma5qd98ttna38
committer: Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com>
branch nick: mysql-5.6
timestamp: Fri 2014-02-28 15:01:41 +0530
message:
Bug#18014565: WRONG RESULT COMPUTATION USING ALL() AND GROUP BY
The first change was merged into MySQL 5.5 and made it to MariaDB 5.5; but then the bug was fixed in MariaDB 5.5 by this revision:
revno: 3895
revision-id: sergii@pisem.net-20130913214200-0b5q0uanbj6mtti7
parent: bar@mnogosearch.org-20130913104740-3nvxlwt6h9pxatqz
fixes bug: https://mariadb.atlassian.net/browse/MDEV-5012
committer: Sergei Golubchik <sergii@pisem.net>
branch nick: 5.5
timestamp: Fri 2013-09-13 23:42:00 +0200
message:
MDEV-5012 Server crashes in Item_ref::real_item on EXPLAIN with select subqueries or views, constant table, derived_merge+derived_with_keys
revert incorrect change, merged from mysql-5.5
So, it's not reproducible on MariaDB 5.5 and 10.0.
Recently, MySQL 5.1 was merged into MariaDB 5.1/5.2/5.3. The faulty change was merged too, so the wrong result started appearing on these trees. But the fix for it only exists in MySQL 5.6 or MariaDB 5.5, so apparently the bug will stay in MySQL 5.1/5.5 forever, and in MariaDB 5.1-5.3 too unless we decide it's worth fixing.
Please decide.
relates to
MDEV-5102
MySQL Bug 69581
Closed
MDEV-5112
InnoDB index intersection returns less results than expected
Closed
links to
Show 2 more links (2 links to)
{"report":{"fcp":934.7999992370605,"ttfb":290.69999980926514,"pageVisibility":"visible","entityId":35708,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"423b1dbe-0e24-4893-a9bd-7549a7d16fee","navigationType":0,"readyForUser":1025.1999998092651,"redirectCount":0,"resourceLoadedEnd":1073,"resourceLoadedStart":296.69999980926514,"resourceTiming":[{"duration":74.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":296.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":296.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":370.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":74.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":296.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":296.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371.0999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":123,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":297.19999980926514,"connectEnd":297.19999980926514,"connectStart":297.19999980926514,"domainLookupEnd":297.19999980926514,"domainLookupStart":297.19999980926514,"fetchStart":297.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":297.19999980926514,"responseEnd":420.19999980926514,"responseStart":420.19999980926514,"secureConnectionStart":297.19999980926514},{"duration":183.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":297.3999996185303,"connectEnd":297.3999996185303,"connectStart":297.3999996185303,"domainLookupEnd":297.3999996185303,"domainLookupStart":297.3999996185303,"fetchStart":297.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":297.3999996185303,"responseEnd":480.8999996185303,"responseStart":480.8999996185303,"secureConnectionStart":297.3999996185303},{"duration":187.60000038146973,"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":297.5999994277954,"connectEnd":297.5999994277954,"connectStart":297.5999994277954,"domainLookupEnd":297.5999994277954,"domainLookupStart":297.5999994277954,"fetchStart":297.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":297.5999994277954,"responseEnd":485.19999980926514,"responseStart":485.19999980926514,"secureConnectionStart":297.5999994277954},{"duration":187.9000005722046,"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":297.79999923706055,"connectEnd":297.79999923706055,"connectStart":297.79999923706055,"domainLookupEnd":297.79999923706055,"domainLookupStart":297.79999923706055,"fetchStart":297.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":297.79999923706055,"responseEnd":485.69999980926514,"responseStart":485.69999980926514,"secureConnectionStart":297.79999923706055},{"duration":188.19999980926514,"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":298,"connectEnd":298,"connectStart":298,"domainLookupEnd":298,"domainLookupStart":298,"fetchStart":298,"redirectEnd":0,"redirectStart":0,"requestStart":298,"responseEnd":486.19999980926514,"responseStart":486.19999980926514,"secureConnectionStart":298},{"duration":264.69999980926514,"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":298.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":298.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":562.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":188.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":298.29999923706055,"connectEnd":298.29999923706055,"connectStart":298.29999923706055,"domainLookupEnd":298.29999923706055,"domainLookupStart":298.29999923706055,"fetchStart":298.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":298.29999923706055,"responseEnd":486.69999980926514,"responseStart":486.69999980926514,"secureConnectionStart":298.29999923706055},{"duration":264.5999994277954,"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":298.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":298.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":563.0999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":188.80000019073486,"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":298.5999994277954,"connectEnd":298.5999994277954,"connectStart":298.5999994277954,"domainLookupEnd":298.5999994277954,"domainLookupStart":298.5999994277954,"fetchStart":298.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":298.5999994277954,"responseEnd":487.3999996185303,"responseStart":487.3999996185303,"secureConnectionStart":298.5999994277954},{"duration":412.0999994277954,"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":300.69999980926514,"connectEnd":300.69999980926514,"connectStart":300.69999980926514,"domainLookupEnd":300.69999980926514,"domainLookupStart":300.69999980926514,"fetchStart":300.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":300.69999980926514,"responseEnd":712.7999992370605,"responseStart":712.7999992370605,"secureConnectionStart":300.69999980926514},{"duration":708.5,"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":300.79999923706055,"connectEnd":300.79999923706055,"connectStart":300.79999923706055,"domainLookupEnd":300.79999923706055,"domainLookupStart":300.79999923706055,"fetchStart":300.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":300.79999923706055,"responseEnd":1009.2999992370605,"responseStart":1009.2999992370605,"secureConnectionStart":300.79999923706055},{"duration":155.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":576,"connectEnd":576,"connectStart":576,"domainLookupEnd":576,"domainLookupStart":576,"fetchStart":576,"redirectEnd":0,"redirectStart":0,"requestStart":576,"responseEnd":731.3999996185303,"responseStart":731.3999996185303,"secureConnectionStart":576},{"duration":209.5999994277954,"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","startTime":852.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":852.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1062.2999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":213.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":853.6999998092651,"connectEnd":853.6999998092651,"connectStart":853.6999998092651,"domainLookupEnd":853.6999998092651,"domainLookupStart":853.6999998092651,"fetchStart":853.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":853.6999998092651,"responseEnd":1067.5999994277954,"responseStart":1067.5999994277954,"secureConnectionStart":853.6999998092651},{"duration":215.80000019073486,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":928.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":928.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1144.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":218.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/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.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":854.1999998092651,"connectEnd":854.1999998092651,"connectStart":854.1999998092651,"domainLookupEnd":854.1999998092651,"domainLookupStart":854.1999998092651,"fetchStart":854.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":854.1999998092651,"responseEnd":1073,"responseStart":1073,"secureConnectionStart":854.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":121,"responseStart":291,"responseEnd":294,"domLoading":294,"domInteractive":1090,"domContentLoadedEventStart":1090,"domContentLoadedEventEnd":1135,"domComplete":1580,"loadEventStart":1580,"loadEventEnd":1582,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1077},{"name":"bigPipe.sidebar-id.end","time":1077.7999992370605},{"name":"bigPipe.activity-panel-pipe-id.start","time":1078},{"name":"bigPipe.activity-panel-pipe-id.end","time":1080.5999994277954},{"name":"activityTabFullyLoaded","time":1150.0999994277954}],"measures":[],"correlationId":"87a7cbcd4a4000","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}