I run the following statements, in which an incorrect query result is returned.
CREATE TABLE t1 (c1 TEXT, UNIQUE (c1(1)));
|
INSERT INTO t1 (c1) VALUES ('a');
|
SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE; -- {}, expected: {a}
|
{"report":{"fcp":1355.3000001907349,"ttfb":408.30000019073486,"pageVisibility":"visible","entityId":133498,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"bc8cf450-48ab-4a9c-87bc-888c8401c25c","navigationType":0,"readyForUser":1497.5999999046326,"redirectCount":0,"resourceLoadedEnd":1111.0999999046326,"resourceLoadedStart":421.19999980926514,"resourceTiming":[{"duration":308.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":421.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":421.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":729.5,"responseStart":0,"secureConnectionStart":0},{"duration":308.69999980926514,"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":421.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":421.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":730.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":318.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":421.69999980926514,"connectEnd":421.69999980926514,"connectStart":421.69999980926514,"domainLookupEnd":421.69999980926514,"domainLookupStart":421.69999980926514,"fetchStart":421.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":421.69999980926514,"responseEnd":740.1999998092651,"responseStart":740.1999998092651,"secureConnectionStart":421.69999980926514},{"duration":384.8999996185303,"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":421.80000019073486,"connectEnd":421.80000019073486,"connectStart":421.80000019073486,"domainLookupEnd":421.80000019073486,"domainLookupStart":421.80000019073486,"fetchStart":421.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":421.80000019073486,"responseEnd":806.6999998092651,"responseStart":806.6999998092651,"secureConnectionStart":421.80000019073486},{"duration":388.80000019073486,"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":422.09999990463257,"connectEnd":422.09999990463257,"connectStart":422.09999990463257,"domainLookupEnd":422.09999990463257,"domainLookupStart":422.09999990463257,"fetchStart":422.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":422.09999990463257,"responseEnd":810.9000000953674,"responseStart":810.9000000953674,"secureConnectionStart":422.09999990463257},{"duration":389.2999997138977,"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":422.30000019073486,"connectEnd":422.30000019073486,"connectStart":422.30000019073486,"domainLookupEnd":422.30000019073486,"domainLookupStart":422.30000019073486,"fetchStart":422.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":422.30000019073486,"responseEnd":811.5999999046326,"responseStart":811.5999999046326,"secureConnectionStart":422.30000019073486},{"duration":389.40000009536743,"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":422.5,"connectEnd":422.5,"connectStart":422.5,"domainLookupEnd":422.5,"domainLookupStart":422.5,"fetchStart":422.5,"redirectEnd":0,"redirectStart":0,"requestStart":422.5,"responseEnd":811.9000000953674,"responseStart":811.9000000953674,"secureConnectionStart":422.5},{"duration":473.40000009536743,"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":422.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":422.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":896,"responseStart":0,"secureConnectionStart":0},{"duration":389.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":422.80000019073486,"connectEnd":422.80000019073486,"connectStart":422.80000019073486,"domainLookupEnd":422.80000019073486,"domainLookupStart":422.80000019073486,"fetchStart":422.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":422.80000019073486,"responseEnd":812.5999999046326,"responseStart":812.5999999046326,"secureConnectionStart":422.80000019073486},{"duration":473.19999980926514,"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":423,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":423,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":896.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":390.09999990463257,"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":423.09999990463257,"connectEnd":423.09999990463257,"connectStart":423.09999990463257,"domainLookupEnd":423.09999990463257,"domainLookupStart":423.09999990463257,"fetchStart":423.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":423.09999990463257,"responseEnd":813.1999998092651,"responseStart":813.1999998092651,"secureConnectionStart":423.09999990463257},{"duration":546.8000001907349,"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":425.09999990463257,"connectEnd":425.09999990463257,"connectStart":425.09999990463257,"domainLookupEnd":425.09999990463257,"domainLookupStart":425.09999990463257,"fetchStart":425.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":425.09999990463257,"responseEnd":971.9000000953674,"responseStart":971.9000000953674,"secureConnectionStart":425.09999990463257},{"duration":681.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":429.59999990463257,"connectEnd":429.59999990463257,"connectStart":429.59999990463257,"domainLookupEnd":429.59999990463257,"domainLookupStart":429.59999990463257,"fetchStart":429.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":429.59999990463257,"responseEnd":1111.0999999046326,"responseStart":1111.0999999046326,"secureConnectionStart":429.59999990463257},{"duration":100.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":911.9000000953674,"connectEnd":911.9000000953674,"connectStart":911.9000000953674,"domainLookupEnd":911.9000000953674,"domainLookupStart":911.9000000953674,"fetchStart":911.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":911.9000000953674,"responseEnd":1012,"responseStart":1012,"secureConnectionStart":911.9000000953674},{"duration":465.19999980926514,"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&whisper-enabled=true","startTime":1284.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1284.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1750,"responseStart":0,"secureConnectionStart":0},{"duration":464.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/50bc9be5bfead1a25e72c1a9338c94f6-CDN/lu2cib/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/css/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1285.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1285.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1750.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":413.19999980926514,"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&whisper-enabled=true","startTime":1286.3000001907349,"connectEnd":1286.3000001907349,"connectStart":1286.3000001907349,"domainLookupEnd":1286.3000001907349,"domainLookupStart":1286.3000001907349,"fetchStart":1286.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1286.3000001907349,"responseEnd":1699.5,"responseStart":1699.5,"secureConnectionStart":1286.3000001907349},{"duration":418.3999996185303,"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&whisper-enabled=true","startTime":1287.3000001907349,"connectEnd":1287.3000001907349,"connectStart":1287.3000001907349,"domainLookupEnd":1287.3000001907349,"domainLookupStart":1287.3000001907349,"fetchStart":1287.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1287.3000001907349,"responseEnd":1705.6999998092651,"responseStart":1705.6999998092651,"secureConnectionStart":1287.3000001907349},{"duration":419.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/e0bf5781d46ea69fb123572974cf39de-CDN/lu2cib/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/js/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1287.6999998092651,"connectEnd":1287.6999998092651,"connectStart":1287.6999998092651,"domainLookupEnd":1287.6999998092651,"domainLookupStart":1287.6999998092651,"fetchStart":1287.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1287.6999998092651,"responseEnd":1707.0999999046326,"responseStart":1707.0999999046326,"secureConnectionStart":1287.6999998092651},{"duration":416.30000019073486,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1344.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1344.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1760.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":242,"responseStart":408,"responseEnd":420,"domLoading":418,"domInteractive":1678,"domContentLoadedEventStart":1678,"domContentLoadedEventEnd":1750,"domComplete":2320,"loadEventStart":2321,"loadEventEnd":2321,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1634.5},{"name":"bigPipe.sidebar-id.end","time":1635.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1635.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1638.9000000953674},{"name":"activityTabFullyLoaded","time":1771.0999999046326}],"measures":[],"correlationId":"87bc82e06c853","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":97,"dbReadsTimeInMs":8,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks!
11.8.1:
MariaDB [test]> CREATE TABLE t1 (c1 TEXT, UNIQUE a (c1(1))) engine=innodb;
Query OK, 0 rows affected (0,053 sec)
MariaDB [test]> INSERT INTO t1 (c1) VALUES ('a');
Query OK, 1 row affected (0,006 sec)
MariaDB [test]> SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
Empty set (0,001 sec)
MariaDB [test]> explain extended SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | |
| 2 | SUBQUERY | t1 | index_subquery | a | a | 7 | const | 1 | 100.00 | |
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
2 rows in set, 1 warning (0,004 sec)
Note (Code 1003): /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 1
MariaDB [test]> explain extended SELECT c1 FROM t1 ignore index (a) WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | |
| 2 | SUBQUERY | t1 | index_subquery | a | a | 7 | const | 1 | 100.00 | |
+------+-------------+-------+----------------+---------------+------+---------+-------+------+----------+-------+
2 rows in set, 1 warning (0,004 sec)
Note (Code 1003): /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` IGNORE INDEX (`a`) where 1
MariaDB [test]> alter table t1 drop index a;
Query OK, 0 rows affected (0,055 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+
| c1 |
+------+
| a |
+------+
1 row in set (0,005 sec)
MariaDB [test]> explain extended SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | |
| 2 | SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+------+----------+-------------+
2 rows in set, 1 warning (0,002 sec)
Note (Code 1003): /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 1
11.4:
MariaDB [test]> CREATE TABLE t1 (c1 TEXT, UNIQUE a (c1(1))) engine=innodb;
Query OK, 0 rows affected (0,054 sec)
MariaDB [test]> INSERT INTO t1 (c1) VALUES ('a');
Query OK, 1 row affected (0,006 sec)
MariaDB [test]> SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+
| c1 |
+------+
| a |
+------+
1 row in set (0,002 sec)
MariaDB [test]> explain extended SELECT c1 FROM t1 WHERE ('abc' IN (SELECT c1 FROM t1)) IS FALSE;
+------+-------------+-------+-------------+---------------+------+---------+-------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+-------+-------------+---------------+------+---------+-------+------+----------+-------------+
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 1 | 100.00 | |
| 2 | SUBQUERY | t1 | ref_or_null | a | a | 4 | const | 1 | 100.00 | Using where |
+------+-------------+-------+-------------+---------------+------+---------+-------+------+----------+-------------+
2 rows in set, 1 warning (0,004 sec)
Note (Code 1003): /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 1