The test case below returns different results when a query is run with a MERGE view comparing to a TEMPTABLE view or a base table. I believe that the TEMPTABLE/base table result is correct.
It can be related to MDEV-3873, there are similarities.
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES (1),(2);
|
|
CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
|
INSERT INTO t2 VALUES (1),(3);
|
|
CREATE OR REPLACE ALGORITHM=MERGE VIEW v AS SELECT * FROM t2;
|
|
SELECT a FROM t1 AS alias
|
WHERE a >= ALL (
|
SELECT b FROM t1 LEFT JOIN v ON (a = b)
|
WHERE a = alias.a );
|
Actual result:
Result with a TEMPTABLE view or a base table:
Result:
EXPLAIN with the MERGE view:
id select_type table type possible_keys key key_len ref rows filtered Extra
|
1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where
|
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
Warnings:
|
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
|
Note 1003 select `test`.`alias`.`a` AS `a` from `test`.`t1` `alias` where <not>(<expr_cache><`test`.`alias`.`a`>(<in_optimizer>(`test`.`alias`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t1` left join (`test`.`t2`) on((`test`.`t2`.`b` = `test`.`t1`.`a`)) where ((`test`.`t1`.`a` = `test`.`alias`.`a`) and (<cache>(`test`.`alias`.`a`) < `test`.`t2`.`b`))))))
|
branch: maria/5.3
|
bzr version-info
|
revision-id: sergii@pisem.net-20121117155015-4ab41ncach4iavao
|
date: 2012-11-17 16:50:15 +0100
|
revno: 3603
|
Also reproducible on MariaDB 5.5, 10.0.
Not reproducible on MariaDB 5.2, MySQL 5.5, 5.6.
- relates to
-
MDEV-3873
Wrong result (extra rows) with NOT IN and a subquery from a MERGE view
-
-
Closed
{"report":{"fcp":849.7000000178814,"ttfb":242.80000001192093,"pageVisibility":"visible","entityId":22011,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"38f4bd2a-4cec-4490-8a7b-c7a51ab907c9","navigationType":0,"readyForUser":964.9000000059605,"redirectCount":0,"resourceLoadedEnd":597.3000000119209,"resourceLoadedStart":248.40000000596046,"resourceTiming":[{"duration":64.40000000596046,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":248.40000000596046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":312.80000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":64.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":248.59999999403954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":313.2000000178814,"responseStart":0,"secureConnectionStart":0},{"duration":200,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":248.80000001192093,"connectEnd":248.80000001192093,"connectStart":248.80000001192093,"domainLookupEnd":248.80000001192093,"domainLookupStart":248.80000001192093,"fetchStart":248.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":317.7000000178814,"responseEnd":448.80000001192093,"responseStart":338.30000001192093,"secureConnectionStart":248.80000001192093},{"duration":324.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":249,"connectEnd":249,"connectStart":249,"domainLookupEnd":249,"domainLookupStart":249,"fetchStart":249,"redirectEnd":0,"redirectStart":0,"requestStart":320.90000000596046,"responseEnd":573.5999999940395,"responseStart":342.80000001192093,"secureConnectionStart":249},{"duration":100.7999999821186,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":249.2000000178814,"connectEnd":249.2000000178814,"connectStart":249.2000000178814,"domainLookupEnd":249.2000000178814,"domainLookupStart":249.2000000178814,"fetchStart":249.2000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":321.2000000178814,"responseEnd":350,"responseStart":347.2000000178814,"secureConnectionStart":249.2000000178814},{"duration":102.40000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":249.30000001192093,"connectEnd":249.30000001192093,"connectStart":249.30000001192093,"domainLookupEnd":249.30000001192093,"domainLookupStart":249.30000001192093,"fetchStart":249.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":321.7000000178814,"responseEnd":351.7000000178814,"responseStart":348.2000000178814,"secureConnectionStart":249.30000001192093},{"duration":104.2000000178814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":249.5,"connectEnd":249.5,"connectStart":249.5,"domainLookupEnd":249.5,"domainLookupStart":249.5,"fetchStart":249.5,"redirectEnd":0,"redirectStart":0,"requestStart":323.80000001192093,"responseEnd":353.7000000178814,"responseStart":350.5,"secureConnectionStart":249.5},{"duration":70.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":249.7000000178814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":249.7000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":319.90000000596046,"responseStart":0,"secureConnectionStart":0},{"duration":104.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":249.90000000596046,"connectEnd":249.90000000596046,"connectStart":249.90000000596046,"domainLookupEnd":249.90000000596046,"domainLookupStart":249.90000000596046,"fetchStart":249.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":326.90000000596046,"responseEnd":354.40000000596046,"responseStart":352.30000001192093,"secureConnectionStart":249.90000000596046},{"duration":76.40000000596046,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":250,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":250,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":326.40000000596046,"responseStart":0,"secureConnectionStart":0},{"duration":106.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":250.2000000178814,"connectEnd":250.2000000178814,"connectStart":250.2000000178814,"domainLookupEnd":250.2000000178814,"domainLookupStart":250.2000000178814,"fetchStart":250.2000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":335.59999999403954,"responseEnd":356.7000000178814,"responseStart":354.7000000178814,"secureConnectionStart":250.2000000178814},{"duration":342.09999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":255.2000000178814,"connectEnd":255.2000000178814,"connectStart":255.2000000178814,"domainLookupEnd":255.2000000178814,"domainLookupStart":255.2000000178814,"fetchStart":255.2000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":406.40000000596046,"responseEnd":597.3000000119209,"responseStart":593.8000000119209,"secureConnectionStart":255.2000000178814},{"duration":340.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":255.30000001192093,"connectEnd":255.30000001192093,"connectStart":255.30000001192093,"domainLookupEnd":255.30000001192093,"domainLookupStart":255.30000001192093,"fetchStart":255.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":461.80000001192093,"responseEnd":596,"responseStart":588.5,"secureConnectionStart":255.30000001192093},{"duration":108.19999998807907,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":576.8000000119209,"connectEnd":576.8000000119209,"connectStart":576.8000000119209,"domainLookupEnd":576.8000000119209,"domainLookupStart":576.8000000119209,"fetchStart":576.8000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":652,"responseEnd":685,"responseStart":683.8000000119209,"secureConnectionStart":576.8000000119209}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":51,"responseStart":243,"responseEnd":248,"domLoading":246,"domInteractive":1022,"domContentLoadedEventStart":1022,"domContentLoadedEventEnd":1072,"domComplete":1607,"loadEventStart":1607,"loadEventEnd":1607,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1002},{"name":"bigPipe.sidebar-id.end","time":1002.9000000059605},{"name":"bigPipe.activity-panel-pipe-id.start","time":1003},{"name":"bigPipe.activity-panel-pipe-id.end","time":1003.9000000059605},{"name":"activityTabFullyLoaded","time":1090.9000000059605}],"measures":[],"correlationId":"3c3216ebf165d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":14,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Duplicate of https://mariadb.atlassian.net/browse/MDEV-3873