-
Bug
-
-
Major
-
Resolution:
Fixed
-
10.0.3, 5.5.32, 5.1.67, 5.2.14, 5.3.12
-
-
None
-
With the test case below, the first query produces 3 rows, which I believe to be the correct result:
SELECT * FROM iso_code LEFT JOIN ( city LEFT JOIN country ON city.country_code = country.code ) ON iso_code.alpha3 = country.code ;
|
alpha3 country_code name code name
|
USA USA Austin USA United States
|
USA USA Boston USA United States
|
CAN NULL NULL NULL NULL
|
But the second query, which only differs from the previous one by the select list, produces two rows:
SELECT iso_code.alpha3 FROM iso_code LEFT JOIN ( city LEFT JOIN country ON city.country_code = country.code ) ON iso_code.alpha3 = country.code ;
|
alpha3
|
USA
|
CAN
|
Reproducible on MariaDB 5.1 from the beginning of time (tried 5.1.42), 5.2, 5.3, 5.5, 10.0.
Not reproducible on MySQL 5.1, 5.5, 5.6.
--source include/have_innodb.inc
|
|
CREATE TABLE iso_code (alpha3 VARCHAR(3)) ENGINE=InnoDB;
|
INSERT INTO iso_code VALUES ('USA'),('CAN');
|
|
CREATE TABLE city ( country_code VARCHAR(3), name VARCHAR(64)) ENGINE=InnoDB;
|
INSERT INTO city VALUES ('USA','Austin'),('USA','Boston');
|
|
CREATE TABLE country ( code VARCHAR(3), name VARCHAR(64), PRIMARY KEY (code), UNIQUE KEY (name)) ENGINE=InnoDB;
|
INSERT INTO country VALUES ('CAN','Canada'),('USA','United States');
|
|
SELECT * FROM iso_code LEFT JOIN ( city LEFT JOIN country ON city.country_code = country.code ) ON iso_code.alpha3 = country.code ;
|
SELECT iso_code.alpha3 FROM iso_code LEFT JOIN ( city LEFT JOIN country ON city.country_code = country.code ) ON iso_code.alpha3 = country.code ;
|
|
|
DROP TABLE iso_code, city, country;
|
EXPLAIN:
EXPLAIN EXTENDED
|
SELECT iso_code.alpha3 FROM iso_code LEFT JOIN ( city LEFT JOIN country ON city.country_code = country.code ) ON iso_code.alpha3 = country.code ;
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
1 SIMPLE iso_code ALL NULL NULL NULL NULL 2 100.00
|
Warnings:
|
Note 1003 select `test`.`iso_code`.`alpha3` AS `alpha3` from `test`.`iso_code` where 1
|
{"report":{"fcp":1171.9000000953674,"ttfb":276.09999990463257,"pageVisibility":"visible","entityId":25024,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"2b351e7b-a26e-4a89-9ad2-30539b504e32","navigationType":0,"readyForUser":1255.4000000953674,"redirectCount":0,"resourceLoadedEnd":1440.2000002861023,"resourceLoadedStart":284.09999990463257,"resourceTiming":[{"duration":193.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":284.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":284.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":477.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":211.2999997138977,"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":284.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":284.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":495.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":280.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":284.59999990463257,"connectEnd":284.59999990463257,"connectStart":284.59999990463257,"domainLookupEnd":284.59999990463257,"domainLookupStart":284.59999990463257,"fetchStart":284.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":284.59999990463257,"responseEnd":565.2000002861023,"responseStart":565.2000002861023,"secureConnectionStart":284.59999990463257},{"duration":353.5,"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":284.7000002861023,"connectEnd":284.7000002861023,"connectStart":284.7000002861023,"domainLookupEnd":284.7000002861023,"domainLookupStart":284.7000002861023,"fetchStart":284.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":284.7000002861023,"responseEnd":638.2000002861023,"responseStart":638.2000002861023,"secureConnectionStart":284.7000002861023},{"duration":357.5,"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":284.90000009536743,"connectEnd":284.90000009536743,"connectStart":284.90000009536743,"domainLookupEnd":284.90000009536743,"domainLookupStart":284.90000009536743,"fetchStart":284.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":284.90000009536743,"responseEnd":642.4000000953674,"responseStart":642.4000000953674,"secureConnectionStart":284.90000009536743},{"duration":357.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":285.2000002861023,"connectEnd":285.2000002861023,"connectStart":285.2000002861023,"domainLookupEnd":285.2000002861023,"domainLookupStart":285.2000002861023,"fetchStart":285.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":285.2000002861023,"responseEnd":642.8000001907349,"responseStart":642.8000001907349,"secureConnectionStart":285.2000002861023},{"duration":357.90000009536743,"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":285.30000019073486,"connectEnd":285.30000019073486,"connectStart":285.30000019073486,"domainLookupEnd":285.30000019073486,"domainLookupStart":285.30000019073486,"fetchStart":285.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":285.30000019073486,"responseEnd":643.2000002861023,"responseStart":643.2000002861023,"secureConnectionStart":285.30000019073486},{"duration":436.2000002861023,"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":285.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":285.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":721.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":358,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":285.7000002861023,"connectEnd":285.7000002861023,"connectStart":285.7000002861023,"domainLookupEnd":285.7000002861023,"domainLookupStart":285.7000002861023,"fetchStart":285.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":285.7000002861023,"responseEnd":643.7000002861023,"responseStart":643.7000002861023,"secureConnectionStart":285.7000002861023},{"duration":436,"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":285.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":285.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":721.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":358.2000002861023,"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":286,"connectEnd":286,"connectStart":286,"domainLookupEnd":286,"domainLookupStart":286,"fetchStart":286,"redirectEnd":0,"redirectStart":0,"requestStart":286,"responseEnd":644.2000002861023,"responseStart":644.2000002861023,"secureConnectionStart":286},{"duration":970.5,"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":286.80000019073486,"connectEnd":286.80000019073486,"connectStart":286.80000019073486,"domainLookupEnd":286.80000019073486,"domainLookupStart":286.80000019073486,"fetchStart":286.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":286.80000019073486,"responseEnd":1257.3000001907349,"responseStart":1257.3000001907349,"secureConnectionStart":286.80000019073486},{"duration":1153.4000000953674,"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":286.80000019073486,"connectEnd":286.80000019073486,"connectStart":286.80000019073486,"domainLookupEnd":286.80000019073486,"domainLookupStart":286.80000019073486,"fetchStart":286.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":286.80000019073486,"responseEnd":1440.2000002861023,"responseStart":1440.2000002861023,"secureConnectionStart":286.80000019073486},{"duration":525.4000000953674,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":733.8000001907349,"connectEnd":733.8000001907349,"connectStart":733.8000001907349,"domainLookupEnd":733.8000001907349,"domainLookupStart":733.8000001907349,"fetchStart":733.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":733.8000001907349,"responseEnd":1259.2000002861023,"responseStart":1259.2000002861023,"secureConnectionStart":733.8000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":114,"responseStart":276,"responseEnd":278,"domLoading":279,"domInteractive":1473,"domContentLoadedEventStart":1473,"domContentLoadedEventEnd":1524,"domComplete":3840,"loadEventStart":3840,"loadEventEnd":3841,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1447.4000000953674},{"name":"bigPipe.sidebar-id.end","time":1448.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1448.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1449.7000002861023},{"name":"activityTabFullyLoaded","time":1542.5}],"measures":[],"correlationId":"68b83d587f112a","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":16,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}