Type:
Bug
Priority:
Minor
Resolution:
Fixed
Affects Version/s:
5.1.67 , 5.2.14 , 5.3.12 , 5.5.36 , 10.0.9
Description:
There is a problem on all platforms; to varying degrees.
Windows 32bit and Windows 64bit:
When supplied BIGINT UNSIGNED, the return type is a BIGINT SIGNED,
Others:
The return type appears to be valid however for BIGINT values, the comparison is always
performed as if the values were signed.
Workaround would be to use IF(x>y,x,y) function instead.
How to repeat:
To reproduce this bug, create this simple table.
DROP TABLE `cma`;
CREATE TABLE `cma` (
`a` binary (16) NOT NULL ,
`b` bigint (20) unsigned NOT NULL ,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Execute the following statement twice
INSERT INTO cma
(a, b)
VALUES ( 'foobar' ,13836376518955650385)
ON DUPLICATE KEY UPDATE
b=GREATEST(b, VALUES (b));
{"report":{"fcp":847.2000000178814,"ttfb":178.80000001192093,"pageVisibility":"visible","entityId":20995,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"9da83641-9f19-49f0-8170-06828095996a","navigationType":0,"readyForUser":924.2000000178814,"redirectCount":0,"resourceLoadedEnd":771.3000000119209,"resourceLoadedStart":184.7000000178814,"resourceTiming":[{"duration":181.2999999821186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":184.7000000178814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":184.7000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":366,"responseStart":0,"secureConnectionStart":0},{"duration":181.30000001192093,"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":185,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":185,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":366.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":189.90000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":185.09999999403954,"connectEnd":185.09999999403954,"connectStart":185.09999999403954,"domainLookupEnd":185.09999999403954,"domainLookupStart":185.09999999403954,"fetchStart":185.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":185.09999999403954,"responseEnd":375,"responseStart":375,"secureConnectionStart":185.09999999403954},{"duration":239.40000000596046,"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":185.30000001192093,"connectEnd":185.30000001192093,"connectStart":185.30000001192093,"domainLookupEnd":185.30000001192093,"domainLookupStart":185.30000001192093,"fetchStart":185.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":185.30000001192093,"responseEnd":424.7000000178814,"responseStart":424.7000000178814,"secureConnectionStart":185.30000001192093},{"duration":242.7000000178814,"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":185.59999999403954,"connectEnd":185.59999999403954,"connectStart":185.59999999403954,"domainLookupEnd":185.59999999403954,"domainLookupStart":185.59999999403954,"fetchStart":185.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":185.59999999403954,"responseEnd":428.30000001192093,"responseStart":428.30000001192093,"secureConnectionStart":185.59999999403954},{"duration":243.09999999403954,"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":185.7000000178814,"connectEnd":185.7000000178814,"connectStart":185.7000000178814,"domainLookupEnd":185.7000000178814,"domainLookupStart":185.7000000178814,"fetchStart":185.7000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":185.7000000178814,"responseEnd":428.80000001192093,"responseStart":428.80000001192093,"secureConnectionStart":185.7000000178814},{"duration":243.5,"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":185.90000000596046,"connectEnd":185.90000000596046,"connectStart":185.90000000596046,"domainLookupEnd":185.90000000596046,"domainLookupStart":185.90000000596046,"fetchStart":185.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":185.90000000596046,"responseEnd":429.40000000596046,"responseStart":429.40000000596046,"secureConnectionStart":185.90000000596046},{"duration":327.40000000596046,"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":186.09999999403954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":186.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":513.5,"responseStart":0,"secureConnectionStart":0},{"duration":243.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":186.2000000178814,"connectEnd":186.2000000178814,"connectStart":186.2000000178814,"domainLookupEnd":186.2000000178814,"domainLookupStart":186.2000000178814,"fetchStart":186.2000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":186.2000000178814,"responseEnd":429.80000001192093,"responseStart":429.80000001192093,"secureConnectionStart":186.2000000178814},{"duration":327.19999998807907,"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":186.40000000596046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":186.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":513.5999999940395,"responseStart":0,"secureConnectionStart":0},{"duration":243.90000000596046,"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":186.59999999403954,"connectEnd":186.59999999403954,"connectStart":186.59999999403954,"domainLookupEnd":186.59999999403954,"domainLookupStart":186.59999999403954,"fetchStart":186.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":186.59999999403954,"responseEnd":430.5,"responseStart":430.5,"secureConnectionStart":186.59999999403954},{"duration":373.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":187.40000000596046,"connectEnd":187.40000000596046,"connectStart":187.40000000596046,"domainLookupEnd":187.40000000596046,"domainLookupStart":187.40000000596046,"fetchStart":187.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":187.40000000596046,"responseEnd":560.5,"responseStart":560.5,"secureConnectionStart":187.40000000596046},{"duration":398.40000000596046,"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":187.5,"connectEnd":187.5,"connectStart":187.5,"domainLookupEnd":187.5,"domainLookupStart":187.5,"fetchStart":187.5,"redirectEnd":0,"redirectStart":0,"requestStart":187.5,"responseEnd":585.9000000059605,"responseStart":585.9000000059605,"secureConnectionStart":187.5},{"duration":37,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":524.3000000119209,"connectEnd":524.3000000119209,"connectStart":524.3000000119209,"domainLookupEnd":524.3000000119209,"domainLookupStart":524.3000000119209,"fetchStart":524.3000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":524.3000000119209,"responseEnd":561.3000000119209,"responseStart":561.3000000119209,"secureConnectionStart":524.3000000119209},{"duration":206.80000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/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","startTime":564.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":564.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":771.3000000119209,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":20,"responseStart":179,"responseEnd":182,"domLoading":182,"domInteractive":980,"domContentLoadedEventStart":980,"domContentLoadedEventEnd":1026,"domComplete":1429,"loadEventStart":1429,"loadEventEnd":1429,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":958.5999999940395},{"name":"bigPipe.sidebar-id.end","time":959.3000000119209},{"name":"bigPipe.activity-panel-pipe-id.start","time":959.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":961.2000000178814},{"name":"activityTabFullyLoaded","time":1040.9000000059605}],"measures":[],"correlationId":"a267348ddaf7a7","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":95,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Win32/Win64: GREATEST() does not always return same signness of argument types.
This problem occurs on Windows 32bit and Windows 64bit.
To reproduce this bug, create this simple table.
DROP TABLE `cma`;
CREATE TABLE `cma` (
`a` binary(16) NOT NULL,
`b` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
– Execute the following statement twice
INSERT INTO cma
(a, b)
VALUES ('foobar',13836376518955650385)
ON DUPLICATE KEY UPDATE
b=GREATEST(b,VALUES(b));
A workaround may be to use CAST(GREATEST(...) AS UNSIGNED) .