https://bugs.launchpad.net/maria/+bug/1050806
Also reproducible on MySQL 5.5.27 and filed as http://bugs.mysql.com/bug.php?id=66845
The following query
SELECT * FROM (
|
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
FROM stock
|
WHERE date < '2012-12-12 12:12:12'
|
AND node_uid in (2085, 2084)
|
ORDER BY mirror_date ASC
|
) AS calculated_result;
|
on the test data produces 3 rows on 5.5.27 and 2 rows on 5.5.25. The correct result is 2 rows, which is obvious because the third row has node_uid which is neither 2084 nor 2085.
Reproducible with the default optimizer_switch as well as with all OFF values.
Reproducible with MyISAM, Aria, InnoDB.
Reproducible on MariaDB 5.5.27, MySQL 5.5.27, current maria/5.5 revno 3533.
Could not reproduce on MariaDB 5.5.25, MariaDB 5.3 revno 3576, MySQL 5.6.6.
EXPLAIN (with all OFF values in optimizer switch):
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
2 DERIVED stock range date date 9 NULL 2 100.00Using where; Using filesort
|
Level Code Message
|
Note 1003 select `calculated_result`.`node_uid` AS `node_uid`,`calculated_result`.`date` AS `date`,`calculated_result`.`mirror_date` AS `mirror_date`,`calculated_result`.`result` AS `result` from (select `test`.`stock`.`node_uid` AS `node_uid`,`test`.`stock`.`date` AS `date`,`test`.`stock`.`mirror_date` AS `mirror_date`,(@result:=0) AS `result` from `test`.`stock` where ((`test`.`stock`.`date` < '2012-12-12 12:12:12') and (`test`.`stock`.`node_uid` in (2085,2084))) order by `test`.`stock`.`mirror_date`) `calculated_result`
|
Test case:
DROP TABLE IF EXISTS `stock`;
|
|
CREATE TABLE `stock` (
|
`node_uid` bigint(20) unsigned DEFAULT NULL,
|
`date` datetime DEFAULT NULL,
|
`mirror_date` datetime DEFAULT NULL,
|
KEY `date` (`date`)
|
) ENGINE=MyISAM;
|
|
INSERT INTO `stock` VALUES (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
|
INSERT INTO `stock` VALUES (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
|
INSERT INTO `stock` VALUES (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
|
|
SELECT * FROM (
|
SELECT node_uid, date, mirror_date, @result := 0 AS result
|
FROM stock
|
WHERE date < '2012-12-12 12:12:12'
|
AND node_uid in (2085, 2084)
|
ORDER BY mirror_date ASC
|
) AS calculated_result;
|
|
Expected result:
node_uid date mirror_date result
|
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
|
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
|
Actual result:
node_uid date mirror_date result
|
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
|
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
|
2088 2012-03-01 00:00:00 2013-01-01 00:00:00 0
|
- is duplicated by
-
MDEV-614
LP:1050806 - different result for a query using subquery between 5.5.25 and 5.5.27
-
-
Closed
{"report":{"fcp":1042.0999999046326,"ttfb":268.7999997138977,"pageVisibility":"visible","entityId":14200,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"58485ca8-7ad9-4586-a5ac-100e738f888d","navigationType":0,"readyForUser":1128,"redirectCount":0,"resourceLoadedEnd":735.0999999046326,"resourceLoadedStart":277.2999997138977,"resourceTiming":[{"duration":75.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":277.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":352.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":96.90000009536743,"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":277.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":277.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":374.5,"responseStart":0,"secureConnectionStart":0},{"duration":293.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":277.8999996185303,"connectEnd":376.5,"connectStart":376.5,"domainLookupEnd":376.5,"domainLookupStart":376.5,"fetchStart":277.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":377.09999990463257,"responseEnd":571.5999999046326,"responseStart":402.8999996185303,"secureConnectionStart":376.5},{"duration":440.6000003814697,"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":278.3999996185303,"connectEnd":278.3999996185303,"connectStart":278.3999996185303,"domainLookupEnd":278.3999996185303,"domainLookupStart":278.3999996185303,"fetchStart":278.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":378.2999997138977,"responseEnd":719,"responseStart":394.5,"secureConnectionStart":278.3999996185303},{"duration":128.19999980926514,"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":278.59999990463257,"connectEnd":278.59999990463257,"connectStart":278.59999990463257,"domainLookupEnd":278.59999990463257,"domainLookupStart":278.59999990463257,"fetchStart":278.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":379.69999980926514,"responseEnd":406.7999997138977,"responseStart":404.7999997138977,"secureConnectionStart":278.59999990463257},{"duration":131.59999990463257,"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":278.7999997138977,"connectEnd":278.7999997138977,"connectStart":278.7999997138977,"domainLookupEnd":278.7999997138977,"domainLookupStart":278.7999997138977,"fetchStart":278.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":380.59999990463257,"responseEnd":410.3999996185303,"responseStart":405.7999997138977,"secureConnectionStart":278.7999997138977},{"duration":137.7999997138977,"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":279,"connectEnd":279,"connectStart":279,"domainLookupEnd":279,"domainLookupStart":279,"fetchStart":279,"redirectEnd":0,"redirectStart":0,"requestStart":382.5,"responseEnd":416.7999997138977,"responseStart":412.19999980926514,"secureConnectionStart":279},{"duration":101.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":279.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":279.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":380.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":138.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":279.2999997138977,"connectEnd":279.2999997138977,"connectStart":279.2999997138977,"domainLookupEnd":279.2999997138977,"domainLookupStart":279.2999997138977,"fetchStart":279.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":384.5,"responseEnd":417.3999996185303,"responseStart":413.3999996185303,"secureConnectionStart":279.2999997138977},{"duration":103.39999961853027,"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":279.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":279.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":138.19999980926514,"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":279.59999990463257,"connectEnd":279.59999990463257,"connectStart":279.59999990463257,"domainLookupEnd":279.59999990463257,"domainLookupStart":279.59999990463257,"fetchStart":279.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":385.19999980926514,"responseEnd":417.7999997138977,"responseStart":414.59999990463257,"secureConnectionStart":279.59999990463257},{"duration":452.80000019073486,"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":281.7999997138977,"connectEnd":281.7999997138977,"connectStart":281.7999997138977,"domainLookupEnd":281.7999997138977,"domainLookupStart":281.7999997138977,"fetchStart":281.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":637.5,"responseEnd":734.5999999046326,"responseStart":729.6999998092651,"secureConnectionStart":281.7999997138977},{"duration":453.2000002861023,"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":281.8999996185303,"connectEnd":281.8999996185303,"connectStart":281.8999996185303,"domainLookupEnd":281.8999996185303,"domainLookupStart":281.8999996185303,"fetchStart":281.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":655.5999999046326,"responseEnd":735.0999999046326,"responseStart":730.5999999046326,"secureConnectionStart":281.8999996185303},{"duration":116.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":699.5999999046326,"connectEnd":699.5999999046326,"connectStart":699.5999999046326,"domainLookupEnd":699.5999999046326,"domainLookupStart":699.5999999046326,"fetchStart":699.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":777.1999998092651,"responseEnd":816.1999998092651,"responseStart":814.2999997138977,"secureConnectionStart":699.5999999046326},{"duration":201.7000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":957.2999997138977,"connectEnd":957.2999997138977,"connectStart":957.2999997138977,"domainLookupEnd":957.2999997138977,"domainLookupStart":957.2999997138977,"fetchStart":957.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1125.0999999046326,"responseEnd":1159,"responseStart":1158.1999998092651,"secureConnectionStart":957.2999997138977}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":74,"responseStart":269,"responseEnd":278,"domLoading":272,"domInteractive":1191,"domContentLoadedEventStart":1191,"domContentLoadedEventEnd":1241,"domComplete":1978,"loadEventStart":1978,"loadEventEnd":1978,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1173.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1173.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1174},{"name":"bigPipe.activity-panel-pipe-id.end","time":1175},{"name":"activityTabFullyLoaded","time":1258.7999997138977}],"measures":[],"correlationId":"aaa37ec9f6f5de","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Looks like this change caused it:
http://bazaar.launchpad.net/~mysql/mysql-server/5.5/revision/3827