Type:
Task
Priority:
Minor
Resolution:
Won't Fix
User variables seem to have a COERCIBILITY() of 2, the same as table columns, even when assigned values with higher COERCIBILITY. This can lead to unexpected errors:
CREATE TEMPORARY TABLE t (v varchar (100) COLLATE latin1_swedish_ci, w varchar (100) COLLATE latin1_general_ci);
INSERT INTO t (v,w) VALUES ( 'foo' , 'bar' );
SELECT v,w INTO @v,@w FROM t;
SELECT v= 'foo' ,v= 'bar' ,w= 'foo' ,w= 'bar' FROM t; # comparison of table columns with literals: OK because columns have lower COERCIBILITY than literals
SELECT @v= 'foo' ,@v= 'bar' ,@w= 'foo' ,@w= 'bar' ; # comparison of user variables with literals: OK because user variables have lower COERCIBILITY than literals
SET @f := 'foo' , @b := 'bar' ;
SELECT v=@f,v=@b,w=@f,w=@b FROM t; # comparison of table columns with user variables; FAILS WITH ERROR: Illegal mix of collations
SELECT @v=@f,@v=@b,@w=@f,@w=@b; # comparison of user variables with each other; FAILS WITH ERROR: Illegal mix of collations
DROP TEMPORARY TABLE t;
Or perhaps more succinctly, the following look like they ought to be equivalent, but they aren't:
1. SELECT col='value' FROM table;
2. SET @v := 'value'; SELECT col=@v FROM table;
I would like to suggest that they SHOULD BE... and that the way to make this work correctly would be for user variables to retain/remember the COERCIBILITY of whatever value they're assigned.
i.e. in the following:
SET @a := (SELECT column FROM table), @b := 'literal value';
SELECT COERCIBILITY(@a), COERCIBILITY(@b);
Currently the returned coercibility values are (2,2)... but I am suggesting that they should be (2,4) instead, which are the coercibilities of the values that have been assigned to @a and @b respectively.
relates to
MDEV-35041
Simple comparison causes "Illegal mix of collations" even with default server settings
Closed
{"report":{"fcp":999.2000000476837,"ttfb":143.20000004768372,"pageVisibility":"visible","entityId":109430,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"8b5fb920-ee0c-47c3-badc-2d042f37406a","navigationType":0,"readyForUser":1056.5,"redirectCount":0,"resourceLoadedEnd":892.9000000953674,"resourceLoadedStart":151.30000019073486,"resourceTiming":[{"duration":410.2999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":151.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":151.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":561.6000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":410,"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":151.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":151.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":561.6000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":419.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":151.70000004768372,"connectEnd":151.70000004768372,"connectStart":151.70000004768372,"domainLookupEnd":151.70000004768372,"domainLookupStart":151.70000004768372,"fetchStart":151.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":151.70000004768372,"responseEnd":570.8000001907349,"responseStart":570.8000001907349,"secureConnectionStart":151.70000004768372},{"duration":443.40000009536743,"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":152.20000004768372,"connectEnd":152.20000004768372,"connectStart":152.20000004768372,"domainLookupEnd":152.20000004768372,"domainLookupStart":152.20000004768372,"fetchStart":152.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":152.20000004768372,"responseEnd":595.6000001430511,"responseStart":595.6000001430511,"secureConnectionStart":152.20000004768372},{"duration":446.7999999523163,"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":152.30000019073486,"connectEnd":152.30000019073486,"connectStart":152.30000019073486,"domainLookupEnd":152.30000019073486,"domainLookupStart":152.30000019073486,"fetchStart":152.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":152.30000019073486,"responseEnd":599.1000001430511,"responseStart":599.1000001430511,"secureConnectionStart":152.30000019073486},{"duration":447.40000009536743,"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":152.40000009536743,"connectEnd":152.40000009536743,"connectStart":152.40000009536743,"domainLookupEnd":152.40000009536743,"domainLookupStart":152.40000009536743,"fetchStart":152.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":152.40000009536743,"responseEnd":599.8000001907349,"responseStart":599.8000001907349,"secureConnectionStart":152.40000009536743},{"duration":447.09999990463257,"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":152.40000009536743,"connectEnd":152.40000009536743,"connectStart":152.40000009536743,"domainLookupEnd":152.40000009536743,"domainLookupStart":152.40000009536743,"fetchStart":152.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":152.40000009536743,"responseEnd":599.5,"responseStart":599.5,"secureConnectionStart":152.40000009536743},{"duration":447.89999985694885,"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":152.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":152.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":600.5,"responseStart":0,"secureConnectionStart":0},{"duration":448.10000014305115,"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":152.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":152.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":600.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":447.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":152.70000004768372,"connectEnd":152.70000004768372,"connectStart":152.70000004768372,"domainLookupEnd":152.70000004768372,"domainLookupStart":152.70000004768372,"fetchStart":152.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":152.70000004768372,"responseEnd":600.2000000476837,"responseStart":600.2000000476837,"secureConnectionStart":152.70000004768372},{"duration":447.89999985694885,"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":152.80000019073486,"connectEnd":152.80000019073486,"connectStart":152.80000019073486,"domainLookupEnd":152.80000019073486,"domainLookupStart":152.80000019073486,"fetchStart":152.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":152.80000019073486,"responseEnd":600.7000000476837,"responseStart":600.7000000476837,"secureConnectionStart":152.80000019073486},{"duration":502,"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":155.40000009536743,"connectEnd":155.40000009536743,"connectStart":155.40000009536743,"domainLookupEnd":155.40000009536743,"domainLookupStart":155.40000009536743,"fetchStart":155.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":155.40000009536743,"responseEnd":657.4000000953674,"responseStart":657.4000000953674,"secureConnectionStart":155.40000009536743},{"duration":737.2999999523163,"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":155.60000014305115,"connectEnd":155.60000014305115,"connectStart":155.60000014305115,"domainLookupEnd":155.60000014305115,"domainLookupStart":155.60000014305115,"fetchStart":155.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":155.60000014305115,"responseEnd":892.9000000953674,"responseStart":892.9000000953674,"secureConnectionStart":155.60000014305115}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":20,"responseStart":144,"responseEnd":155,"domLoading":146,"domInteractive":1111,"domContentLoadedEventStart":1111,"domContentLoadedEventEnd":1153,"domComplete":2217,"loadEventStart":2217,"loadEventEnd":2218,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1092},{"name":"bigPipe.sidebar-id.end","time":1092.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":1093},{"name":"bigPipe.activity-panel-pipe-id.end","time":1095.5},{"name":"activityTabFullyLoaded","time":1158.6000001430511}],"measures":[],"correlationId":"4fc060f885393","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":72,"dbReadsTimeInMs":7,"dbConnsTimeInMs":14,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}