-
Bug
-
-
Major
-
Resolution:
Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
-
-
MAKETIME() returns bad results in some cases:
SELECT
|
MAKETIME(1e10,0,0),
|
MAKETIME(-1e10,0,0),
|
MAKETIME(1e50,0,0),
|
MAKETIME(-1e50,0,0),
|
MAKETIME(COALESCE(1e50),0,0),
|
MAKETIME(COALESCE(-1e50),0,0)\G
|
*************************** 1. row ***************************
|
MAKETIME(1e10,0,0): 838:59:59
|
MAKETIME(-1e10,0,0): -838:59:59
|
MAKETIME(1e50,0,0): 838:59:59
|
MAKETIME(-1e50,0,0): -00:00:00
|
MAKETIME(COALESCE(1e50),0,0): -00:00:00
|
MAKETIME(COALESCE(-1e50),0,0): -00:00:00
|
1 row in set, 3 warnings (0.00 sec)
|
Notice wrong '-00:00:00' value. The expected value is '838:59:59' or '-838:59:59' (depending on the sign).
The problem happens for two reasons:
Item_func_hybrid_result_type::val_int is affected
SELECT LEFT('a', COALESCE(1e30));
|
+---------------------------+
|
| LEFT('a', COALESCE(1e30)) |
|
+---------------------------+
|
| |
|
+---------------------------+
|
Field_float::val_int is also affected
A similar problem is repeatable in this script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a FLOAT);
|
INSERT INTO t1 VALUES (1e30);
|
SELECT * FROM t1;
|
SELECT MAKETIME(a,0,0) FROM t1;
|
+-----------------+
|
| MAKETIME(a,0,0) |
|
+-----------------+
|
| -00:00:00 |
|
+-----------------+
|
A similar problem is repeatable in this script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a FLOAT);
|
INSERT INTO t1 VALUES (1e30);
|
SELECT * FROM t1;
|
SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
|
+-------------+----------------+
|
| LEFT('a',a) | LEFT('a',1e30) |
|
+-------------+----------------+
|
| | a |
|
+-------------+----------------+
|
The value for the first column is wrong. The length argument is treated as negative instead of big positive.
Item_param::val_int is also affected
A similar problem is repeatable in this script:
PREPARE stmt FROM 'SELECT LEFT(111,?)';
|
SET @a=1e30;
|
EXECUTE stmt USING @a;
|
+-------------+
|
| LEFT(111,?) |
|
+-------------+
|
| |
|
+-------------+
|
and in this script (in 10.3 and 10.4):
EXECUTE IMMEDIATE 'SELECT LEFT(111,?)' USING 1e30;
|
+-------------+
|
| LEFT(111,?) |
|
+-------------+
|
| |
|
+-------------+
|
The expected result is '111'. The length argument is treated as negative instead of big positive.
Item_cache_real::val_int is also affected
A similar problem is repeatable in this script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a INT);
|
INSERT INTO t1 VALUES (1),(2),(3);
|
SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
|
+-----------------------------------------+
|
| LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)) |
|
+-----------------------------------------+
|
| |
|
+-----------------------------------------+
|
The expected result is 'a'. The length argument is treated as negative instead of big positive.
Item_real_func::val_int is also affected
SELECT LEFT('a',EXP(50));
|
+-------------------+
|
| LEFT('a',EXP(50)) |
|
+-------------------+
|
| |
|
+-------------------+
|
The expected result is 'a'.
A few method in item_sum.h and item_sum.cc are also affected
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DOUBLE);
|
INSERT INTO t1 VALUES (1e30),(0);
|
SELECT LEFT('a', SUM(a)) FROM t1;
|
+-------------------+
|
| LEFT('a', SUM(a)) |
|
+-------------------+
|
| |
|
+-------------------+
|
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DOUBLE);
|
INSERT INTO t1 VALUES (1e30),(0);
|
SELECT LEFT('a', AVG(a)) FROM t1;
|
+-------------------+
|
| LEFT('a', AVG(a)) |
|
+-------------------+
|
| |
|
+-------------------+
|
- relates to
-
MDEV-21977
main.func_math fails due to undefined behaviour
-
-
Closed
{"report":{"fcp":1113.5,"ttfb":292,"pageVisibility":"visible","entityId":69877,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"e56b6567-e3fb-449d-8408-b6cc974251b0","navigationType":0,"readyForUser":1227.8000001907349,"redirectCount":0,"resourceLoadedEnd":942.5,"resourceLoadedStart":298.09999990463257,"resourceTiming":[{"duration":334.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":298.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":298.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":633,"responseStart":0,"secureConnectionStart":0},{"duration":334.90000009536743,"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":298.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":298.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":633.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":347,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":298.59999990463257,"connectEnd":298.59999990463257,"connectStart":298.59999990463257,"domainLookupEnd":298.59999990463257,"domainLookupStart":298.59999990463257,"fetchStart":298.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":298.59999990463257,"responseEnd":645.5999999046326,"responseStart":645.5999999046326,"secureConnectionStart":298.59999990463257},{"duration":424.90000009536743,"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":298.80000019073486,"connectEnd":298.80000019073486,"connectStart":298.80000019073486,"domainLookupEnd":298.80000019073486,"domainLookupStart":298.80000019073486,"fetchStart":298.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":298.80000019073486,"responseEnd":723.7000002861023,"responseStart":723.7000002861023,"secureConnectionStart":298.80000019073486},{"duration":428.40000009536743,"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":299,"connectEnd":299,"connectStart":299,"domainLookupEnd":299,"domainLookupStart":299,"fetchStart":299,"redirectEnd":0,"redirectStart":0,"requestStart":299,"responseEnd":727.4000000953674,"responseStart":727.4000000953674,"secureConnectionStart":299},{"duration":428.69999980926514,"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":299.30000019073486,"connectEnd":299.30000019073486,"connectStart":299.30000019073486,"domainLookupEnd":299.30000019073486,"domainLookupStart":299.30000019073486,"fetchStart":299.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":299.30000019073486,"responseEnd":728,"responseStart":728,"secureConnectionStart":299.30000019073486},{"duration":428.90000009536743,"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":299.40000009536743,"connectEnd":299.40000009536743,"connectStart":299.40000009536743,"domainLookupEnd":299.40000009536743,"domainLookupStart":299.40000009536743,"fetchStart":299.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":299.40000009536743,"responseEnd":728.3000001907349,"responseStart":728.3000001907349,"secureConnectionStart":299.40000009536743},{"duration":489.40000009536743,"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":299.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":299.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":789,"responseStart":0,"secureConnectionStart":0},{"duration":429.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":299.7000002861023,"connectEnd":299.7000002861023,"connectStart":299.7000002861023,"domainLookupEnd":299.7000002861023,"domainLookupStart":299.7000002861023,"fetchStart":299.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":299.7000002861023,"responseEnd":728.8000001907349,"responseStart":728.8000001907349,"secureConnectionStart":299.7000002861023},{"duration":489.19999980926514,"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":299.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":299.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":789.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":429.30000019073486,"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":300.09999990463257,"connectEnd":300.09999990463257,"connectStart":300.09999990463257,"domainLookupEnd":300.09999990463257,"domainLookupStart":300.09999990463257,"fetchStart":300.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":300.09999990463257,"responseEnd":729.4000000953674,"responseStart":729.4000000953674,"secureConnectionStart":300.09999990463257},{"duration":523.9000000953674,"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":300.90000009536743,"connectEnd":300.90000009536743,"connectStart":300.90000009536743,"domainLookupEnd":300.90000009536743,"domainLookupStart":300.90000009536743,"fetchStart":300.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":300.90000009536743,"responseEnd":824.8000001907349,"responseStart":824.8000001907349,"secureConnectionStart":300.90000009536743},{"duration":641.5,"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":301,"connectEnd":301,"connectStart":301,"domainLookupEnd":301,"domainLookupStart":301,"fetchStart":301,"redirectEnd":0,"redirectStart":0,"requestStart":301,"responseEnd":942.5,"responseStart":942.5,"secureConnectionStart":301},{"duration":111,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":817.9000000953674,"connectEnd":817.9000000953674,"connectStart":817.9000000953674,"domainLookupEnd":817.9000000953674,"domainLookupStart":817.9000000953674,"fetchStart":817.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":817.9000000953674,"responseEnd":928.9000000953674,"responseStart":928.9000000953674,"secureConnectionStart":817.9000000953674},{"duration":321.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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","startTime":1068.5,"connectEnd":1068.5,"connectStart":1068.5,"domainLookupEnd":1068.5,"domainLookupStart":1068.5,"fetchStart":1068.5,"redirectEnd":0,"redirectStart":0,"requestStart":1068.5,"responseEnd":1390,"responseStart":1390,"secureConnectionStart":1068.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":103,"responseStart":292,"responseEnd":295,"domLoading":295,"domInteractive":1342,"domContentLoadedEventStart":1342,"domContentLoadedEventEnd":1405,"domComplete":2111,"loadEventStart":2111,"loadEventEnd":2113,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1322.4000000953674},{"name":"bigPipe.sidebar-id.end","time":1323.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1323.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1325.9000000953674},{"name":"activityTabFullyLoaded","time":1416}],"measures":[],"correlationId":"361f57e27213f2","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}