This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
|
INSERT INTO t1 VALUES ('1e1'),('1é1');
|
SELECT * FROM t1 WHERE a=10;
|
SELECT * FROM t1 WHERE a='1e1';
|
SELECT * FROM t1 WHERE a=10 AND a='1e1';
|
returns:
MariaDB [test]> SELECT * FROM t1 WHERE a=10;
|
+------+
|
| a |
|
+------+
|
| 1e1 |
|
+------+
|
1 row in set, 1 warning (0.00 sec)
|
|
MariaDB [test]> SELECT * FROM t1 WHERE a='1e1';
|
+------+
|
| a |
|
+------+
|
| 1e1 |
|
| 1é1 |
|
+------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT * FROM t1 WHERE a=10 AND a='1e1';
|
+------+
|
| a |
|
+------+
|
| 1e1 |
|
+------+
|
1 row in set, 1 warning (0.00 sec)
|
Looks good so far.
Now if I rewrite the last query using ROW syntax:
SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
|
It erroneously starts to return both rows:
+------+
|
| a |
|
+------+
|
| 1e1 |
|
| 1é1 |
|
+------+
|
This EXPLAIN EXTENDED:
MariaDB [test]> EXPLAIN SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
|
+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
|
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 2 | Using where |
|
+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
|
1 row in set (0.00 sec)
|
|
MariaDB [test]> SHOW WARNINGS;
|
Empty set (0.00 sec)
|
|
MariaDB [test]> EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
|
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
|
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
|
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL | 2 | 100.00 | Using where |
|
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
|
1 row in set, 1 warning (0.00 sec)
|
|
MariaDB [test]> SHOW WARNINGS;
|
+-------+------+--------------------------------------------------------------------------------+
|
| Level | Code | Message |
|
+-------+------+--------------------------------------------------------------------------------+
|
| Note | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '1e1') |
|
+-------+------+--------------------------------------------------------------------------------+
|
1 row in set (0.00 sec)
|
|
tells that the a=10 part was moved away from the condition.
This is wrong. It should be preserved.
{"report":{"fcp":1504.4000000953674,"ttfb":371.2999997138977,"pageVisibility":"visible","entityId":51612,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"19be6baf-4c94-4ff1-bc7d-7c0d551da426","navigationType":0,"readyForUser":1613.5999999046326,"redirectCount":0,"resourceLoadedEnd":1411.6999998092651,"resourceLoadedStart":376.90000009536743,"resourceTiming":[{"duration":389.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":376.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":376.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":766.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":389.59999990463257,"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":377.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":377.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":766.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":398.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":377.2999997138977,"connectEnd":377.2999997138977,"connectStart":377.2999997138977,"domainLookupEnd":377.2999997138977,"domainLookupStart":377.2999997138977,"fetchStart":377.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":377.2999997138977,"responseEnd":775.6999998092651,"responseStart":775.6999998092651,"secureConnectionStart":377.2999997138977},{"duration":460.7999997138977,"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":377.5,"connectEnd":377.5,"connectStart":377.5,"domainLookupEnd":377.5,"domainLookupStart":377.5,"fetchStart":377.5,"redirectEnd":0,"redirectStart":0,"requestStart":377.5,"responseEnd":838.2999997138977,"responseStart":838.2999997138977,"secureConnectionStart":377.5},{"duration":466.40000009536743,"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":377.69999980926514,"connectEnd":377.69999980926514,"connectStart":377.69999980926514,"domainLookupEnd":377.69999980926514,"domainLookupStart":377.69999980926514,"fetchStart":377.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":377.69999980926514,"responseEnd":844.0999999046326,"responseStart":844.0999999046326,"secureConnectionStart":377.69999980926514},{"duration":467.3999996185303,"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":377.90000009536743,"connectEnd":377.90000009536743,"connectStart":377.90000009536743,"domainLookupEnd":377.90000009536743,"domainLookupStart":377.90000009536743,"fetchStart":377.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":377.90000009536743,"responseEnd":845.2999997138977,"responseStart":845.2999997138977,"secureConnectionStart":377.90000009536743},{"duration":468,"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":378.19999980926514,"connectEnd":378.19999980926514,"connectStart":378.19999980926514,"domainLookupEnd":378.19999980926514,"domainLookupStart":378.19999980926514,"fetchStart":378.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":378.19999980926514,"responseEnd":846.1999998092651,"responseStart":846.1999998092651,"secureConnectionStart":378.19999980926514},{"duration":565.2999997138977,"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":378.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":378.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":943.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":468.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":378.5,"connectEnd":378.5,"connectStart":378.5,"domainLookupEnd":378.5,"domainLookupStart":378.5,"fetchStart":378.5,"redirectEnd":0,"redirectStart":0,"requestStart":378.5,"responseEnd":846.7999997138977,"responseStart":846.7999997138977,"secureConnectionStart":378.5},{"duration":565.2000002861023,"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":378.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":378.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":943.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":468.69999980926514,"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":378.90000009536743,"connectEnd":378.90000009536743,"connectStart":378.90000009536743,"domainLookupEnd":378.90000009536743,"domainLookupStart":378.90000009536743,"fetchStart":378.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":378.90000009536743,"responseEnd":847.5999999046326,"responseStart":847.5,"secureConnectionStart":378.90000009536743},{"duration":665.7000002861023,"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":385.2999997138977,"connectEnd":385.2999997138977,"connectStart":385.2999997138977,"domainLookupEnd":385.2999997138977,"domainLookupStart":385.2999997138977,"fetchStart":385.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":385.2999997138977,"responseEnd":1051,"responseStart":1051,"secureConnectionStart":385.2999997138977},{"duration":1022.2999997138977,"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":389.40000009536743,"connectEnd":389.40000009536743,"connectStart":389.40000009536743,"domainLookupEnd":389.40000009536743,"domainLookupStart":389.40000009536743,"fetchStart":389.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":389.40000009536743,"responseEnd":1411.6999998092651,"responseStart":1411.6999998092651,"secureConnectionStart":389.40000009536743},{"duration":371.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":993.5999999046326,"connectEnd":993.5999999046326,"connectStart":993.5999999046326,"domainLookupEnd":993.5999999046326,"domainLookupStart":993.5999999046326,"fetchStart":993.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":993.5999999046326,"responseEnd":1365.4000000953674,"responseStart":1365.4000000953674,"secureConnectionStart":993.5999999046326}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":193,"responseStart":371,"responseEnd":389,"domLoading":375,"domInteractive":1746,"domContentLoadedEventStart":1746,"domContentLoadedEventEnd":1847,"domComplete":2966,"loadEventStart":2966,"loadEventEnd":2969,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1693.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1696.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1697.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1706.9000000953674},{"name":"activityTabFullyLoaded","time":1858.6999998092651}],"measures":[],"correlationId":"5faf28c95c573c","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":110,"dbReadsTimeInMs":11,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}