UNION of an UNSIGNED result, and a NULL result from a subquery, leads to wrong number of decimals. See the following two one liner test queries, which were run with `mysql --column-type-info`. This only started with 10.3.
MariaDB [test]> select CAST(1 as unsigned) union all select NULL;
|
Field 1: `CAST(1 as unsigned)`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: NEWDECIMAL
|
Collation: binary (63)
|
Length: 2
|
Max_length: 1
|
Decimals: 0
|
Flags: BINARY NUM
|
|
|
+---------------------+
|
| CAST(1 as unsigned) |
|
+---------------------+
|
| 1 |
|
| NULL |
|
+---------------------+
|
2 rows in set (0.000 sec)
|
|
MariaDB [test]> select CAST(1 as unsigned) union all select * from (select NULL) t;
|
Field 1: `CAST(1 as unsigned)`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: NEWDECIMAL
|
Collation: binary (63)
|
Length: 42
|
Max_length: 40
|
Decimals: 39
|
Flags: BINARY NUM
|
|
|
+------------------------------------------+
|
| CAST(1 as unsigned) |
|
+------------------------------------------+
|
| 1.00000000000000000000000000000000000000 |
|
| NULL |
|
+------------------------------------------+
|
2 rows in set (0.000 sec)
|
|
- relates to
-
MDEV-12775
Reuse data type aggregation code for hybrid functions and UNION
-
-
Closed
{"report":{"fcp":1112.7000002861023,"ttfb":253.2000002861023,"pageVisibility":"visible","entityId":94868,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"55287008-4aff-4b17-a420-406f56ca73d1","navigationType":0,"readyForUser":1195.5,"redirectCount":0,"resourceLoadedEnd":1031.7000002861023,"resourceLoadedStart":258.5,"resourceTiming":[{"duration":287.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":258.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":258.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":546.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":287.7999997138977,"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":258.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":258.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":546.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":342.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":259,"connectEnd":259,"connectStart":259,"domainLookupEnd":259,"domainLookupStart":259,"fetchStart":259,"redirectEnd":0,"redirectStart":0,"requestStart":259,"responseEnd":601.9000000953674,"responseStart":601.9000000953674,"secureConnectionStart":259},{"duration":396.8999996185303,"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":259.2000002861023,"connectEnd":259.2000002861023,"connectStart":259.2000002861023,"domainLookupEnd":259.2000002861023,"domainLookupStart":259.2000002861023,"fetchStart":259.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":259.2000002861023,"responseEnd":656.0999999046326,"responseStart":656.0999999046326,"secureConnectionStart":259.2000002861023},{"duration":400.59999990463257,"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":259.40000009536743,"connectEnd":259.40000009536743,"connectStart":259.40000009536743,"domainLookupEnd":259.40000009536743,"domainLookupStart":259.40000009536743,"fetchStart":259.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":259.40000009536743,"responseEnd":660,"responseStart":660,"secureConnectionStart":259.40000009536743},{"duration":400.90000009536743,"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":259.59999990463257,"connectEnd":259.59999990463257,"connectStart":259.59999990463257,"domainLookupEnd":259.59999990463257,"domainLookupStart":259.59999990463257,"fetchStart":259.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":259.59999990463257,"responseEnd":660.5,"responseStart":660.5,"secureConnectionStart":259.59999990463257},{"duration":401,"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":259.80000019073486,"connectEnd":259.80000019073486,"connectStart":259.80000019073486,"domainLookupEnd":259.80000019073486,"domainLookupStart":259.80000019073486,"fetchStart":259.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":259.80000019073486,"responseEnd":660.8000001907349,"responseStart":660.8000001907349,"secureConnectionStart":259.80000019073486},{"duration":485.59999990463257,"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":259.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":259.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":745.5,"responseStart":0,"secureConnectionStart":0},{"duration":401.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":260.09999990463257,"connectEnd":260.09999990463257,"connectStart":260.09999990463257,"domainLookupEnd":260.09999990463257,"domainLookupStart":260.09999990463257,"fetchStart":260.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":260.09999990463257,"responseEnd":661.4000000953674,"responseStart":661.4000000953674,"secureConnectionStart":260.09999990463257},{"duration":485.40000009536743,"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":260.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":260.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":745.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":401.40000009536743,"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":260.5,"connectEnd":260.5,"connectStart":260.5,"domainLookupEnd":260.5,"domainLookupStart":260.5,"fetchStart":260.5,"redirectEnd":0,"redirectStart":0,"requestStart":260.5,"responseEnd":661.9000000953674,"responseStart":661.9000000953674,"secureConnectionStart":260.5},{"duration":533.2999997138977,"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":265.80000019073486,"connectEnd":265.80000019073486,"connectStart":265.80000019073486,"domainLookupEnd":265.80000019073486,"domainLookupStart":265.80000019073486,"fetchStart":265.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":265.80000019073486,"responseEnd":799.0999999046326,"responseStart":799.0999999046326,"secureConnectionStart":265.80000019073486},{"duration":551.9000000953674,"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":265.80000019073486,"connectEnd":265.80000019073486,"connectStart":265.80000019073486,"domainLookupEnd":265.80000019073486,"domainLookupStart":265.80000019073486,"fetchStart":265.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":265.80000019073486,"responseEnd":817.7000002861023,"responseStart":817.7000002861023,"secureConnectionStart":265.80000019073486},{"duration":55.69999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":757.9000000953674,"connectEnd":757.9000000953674,"connectStart":757.9000000953674,"domainLookupEnd":757.9000000953674,"domainLookupStart":757.9000000953674,"fetchStart":757.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":757.9000000953674,"responseEnd":813.5999999046326,"responseStart":813.5999999046326,"secureConnectionStart":757.9000000953674},{"duration":203.40000009536743,"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":828.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":828.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1031.7000002861023,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":86,"responseStart":253,"responseEnd":259,"domLoading":256,"domInteractive":1254,"domContentLoadedEventStart":1254,"domContentLoadedEventEnd":1307,"domComplete":1622,"loadEventStart":1623,"loadEventEnd":1623,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1233.2000002861023},{"name":"bigPipe.sidebar-id.end","time":1234.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1234.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1235.8000001907349},{"name":"activityTabFullyLoaded","time":1323.2000002861023}],"measures":[],"correlationId":"82eb2b4706d9c0","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":104,"dbReadsTimeInMs":14,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
it was changed after https://github.com/MariaDB/server/commit/705fc43eaa (
MDEV-12775)