This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10) CHARSET utf8);
|
INSERT INTO t1 VALUES ('1');
|
SELECT * FROM t1 WHERE a LIKE 1;
|
correctly returns one row:
+------+
|
| a |
|
+------+
|
| 1 |
|
+------+
|
If I change character set from utf8 to ucs2, it returns empty set:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10) CHARSET ucs2);
|
INSERT INTO t1 VALUES ('1');
|
SELECT * FROM t1 WHERE a LIKE 1;
|
The problem happens in this piece of the code:
bool Item_func::setup_args_and_comparator(THD *thd, Arg_comparator *cmp)
|
{
|
DBUG_ASSERT(arg_count == 2);
|
|
if (args[0]->cmp_type() == STRING_RESULT &&
|
args[1]->cmp_type() == STRING_RESULT &&
|
agg_arg_charsets_for_comparison(cmp->cmp_collation, args, 2))
|
return true;
|
In case of LIKE it should unconditionally call arg_arg_charsets_for_comparison(), no matter that cmp_type() of the arguments are.
{"report":{"fcp":924.7999999523163,"ttfb":275.60000014305115,"pageVisibility":"visible","entityId":51506,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"5a15378b-e736-429b-bb10-3f925d6898e1","navigationType":0,"readyForUser":983.9000000953674,"redirectCount":0,"resourceLoadedEnd":1282.7999999523163,"resourceLoadedStart":280.7999999523163,"resourceTiming":[{"duration":211.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":280.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":280.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.60000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":211.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":281.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":220.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":281.2999999523163,"connectEnd":281.2999999523163,"connectStart":281.2999999523163,"domainLookupEnd":281.2999999523163,"domainLookupStart":281.2999999523163,"fetchStart":281.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":281.2999999523163,"responseEnd":501.7000000476837,"responseStart":501.7000000476837,"secureConnectionStart":281.2999999523163},{"duration":245.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":281.2999999523163,"connectEnd":281.2999999523163,"connectStart":281.2999999523163,"domainLookupEnd":281.2999999523163,"domainLookupStart":281.2999999523163,"fetchStart":281.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":281.2999999523163,"responseEnd":527,"responseStart":527,"secureConnectionStart":281.2999999523163},{"duration":249.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":281.40000009536743,"connectEnd":281.40000009536743,"connectStart":281.40000009536743,"domainLookupEnd":281.40000009536743,"domainLookupStart":281.40000009536743,"fetchStart":281.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":281.40000009536743,"responseEnd":530.6000001430511,"responseStart":530.6000001430511,"secureConnectionStart":281.40000009536743},{"duration":249.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":281.60000014305115,"connectEnd":281.60000014305115,"connectStart":281.60000014305115,"domainLookupEnd":281.60000014305115,"domainLookupStart":281.60000014305115,"fetchStart":281.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":281.60000014305115,"responseEnd":531,"responseStart":531,"secureConnectionStart":281.60000014305115},{"duration":249.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":281.60000014305115,"connectEnd":281.60000014305115,"connectStart":281.60000014305115,"domainLookupEnd":281.60000014305115,"domainLookupStart":281.60000014305115,"fetchStart":281.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":281.60000014305115,"responseEnd":531.5,"responseStart":531.5,"secureConnectionStart":281.60000014305115},{"duration":250.20000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":281.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532,"responseStart":0,"secureConnectionStart":0},{"duration":250.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":281.7999999523163,"connectEnd":281.7999999523163,"connectStart":281.7999999523163,"domainLookupEnd":281.7999999523163,"domainLookupStart":281.7999999523163,"fetchStart":281.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":281.7999999523163,"responseEnd":532,"responseStart":532,"secureConnectionStart":281.7999999523163},{"duration":250.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":281.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":250.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":282.10000014305115,"connectEnd":282.10000014305115,"connectStart":282.10000014305115,"domainLookupEnd":282.10000014305115,"domainLookupStart":282.10000014305115,"fetchStart":282.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":282.10000014305115,"responseEnd":532.5,"responseStart":532.5,"secureConnectionStart":282.10000014305115},{"duration":609.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":282.60000014305115,"connectEnd":282.60000014305115,"connectStart":282.60000014305115,"domainLookupEnd":282.60000014305115,"domainLookupStart":282.60000014305115,"fetchStart":282.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":282.60000014305115,"responseEnd":891.9000000953674,"responseStart":891.9000000953674,"secureConnectionStart":282.60000014305115},{"duration":1000.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":282.60000014305115,"connectEnd":282.60000014305115,"connectStart":282.60000014305115,"domainLookupEnd":282.60000014305115,"domainLookupStart":282.60000014305115,"fetchStart":282.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":282.60000014305115,"responseEnd":1282.7999999523163,"responseStart":1282.7999999523163,"secureConnectionStart":282.60000014305115},{"duration":442.89999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":731.1000001430511,"connectEnd":731.1000001430511,"connectStart":731.1000001430511,"domainLookupEnd":731.1000001430511,"domainLookupStart":731.1000001430511,"fetchStart":731.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":731.1000001430511,"responseEnd":1174,"responseStart":1174,"secureConnectionStart":731.1000001430511},{"duration":430.09999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":903.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":903.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1333.7999999523163,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":141,"responseStart":275,"responseEnd":276,"domLoading":278,"domInteractive":1302,"domContentLoadedEventStart":1302,"domContentLoadedEventEnd":1334,"domComplete":2184,"loadEventStart":2184,"loadEventEnd":2185,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1286.1000001430511},{"name":"bigPipe.sidebar-id.end","time":1287},{"name":"bigPipe.activity-panel-pipe-id.start","time":1287.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1289.5},{"name":"activityTabFullyLoaded","time":1341.2999999523163}],"measures":[],"correlationId":"993add82e1ebc6","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":77,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}