If I start mysql --column-type-info and run this script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DATETIME);
|
INSERT INTO t1 VALUES ('2001-01-01 10:20:30'),('2001-01-02 10:20:30');
|
SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
|
it returns a correct result set:
+---------------------+---------------------+
|
| MAX(a) | MAX(COALESCE(a)) |
|
+---------------------+---------------------+
|
| 2001-01-02 10:20:30 | 2001-01-02 10:20:30 |
|
+---------------------+---------------------+
|
but the metadata is wrong:
Field 1: `MAX(a)`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: DATETIME
|
Collation: binary (63)
|
Length: 19
|
Max_length: 19
|
Decimals: 0
|
Flags: BINARY
|
|
Field 2: `MAX(COALESCE(a))`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: VAR_STRING
|
Collation: utf8_general_ci (33)
|
Length: 57
|
Max_length: 19
|
Decimals: 0
|
Flags:
|
Notice, metadata for MAX(COALESCE(a)) says it's a VAR_STRING column.
The correct result is to return the DATETIME data type, as for the first column.
If I change the column data type from DATETIME to TIME:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a TIME);
|
INSERT INTO t1 VALUES ('10:20:30'),('10:20:30');
|
SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
|
it also returns VAR_STRING for the second column.
There are no comments yet on this issue.
{"report":{"fcp":961,"ttfb":367.19999980926514,"pageVisibility":"visible","entityId":53406,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"b4be2657-601a-4525-aa40-7f4077ec9a1d","navigationType":0,"readyForUser":1031.0999999046326,"redirectCount":0,"resourceLoadedEnd":774.1999998092651,"resourceLoadedStart":374.09999990463257,"resourceTiming":[{"duration":103.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":374.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":374.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":477.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":103.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":374.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":374.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":478.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":146.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":374.69999980926514,"connectEnd":374.69999980926514,"connectStart":374.69999980926514,"domainLookupEnd":374.69999980926514,"domainLookupStart":374.69999980926514,"fetchStart":374.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":485.89999985694885,"responseEnd":521.5,"responseStart":497,"secureConnectionStart":374.69999980926514},{"duration":203.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":374.89999985694885,"connectEnd":374.89999985694885,"connectStart":374.89999985694885,"domainLookupEnd":374.89999985694885,"domainLookupStart":374.89999985694885,"fetchStart":374.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":491.39999985694885,"responseEnd":578.6999998092651,"responseStart":520.3999998569489,"secureConnectionStart":374.89999985694885},{"duration":134.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":375,"connectEnd":495.89999985694885,"connectStart":495.89999985694885,"domainLookupEnd":495.89999985694885,"domainLookupStart":495.89999985694885,"fetchStart":375,"redirectEnd":0,"redirectStart":0,"requestStart":496,"responseEnd":509.59999990463257,"responseStart":508.39999985694885,"secureConnectionStart":495.89999985694885},{"duration":138,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":375.19999980926514,"connectEnd":375.19999980926514,"connectStart":375.19999980926514,"domainLookupEnd":375.19999980926514,"domainLookupStart":375.19999980926514,"fetchStart":375.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":498.19999980926514,"responseEnd":513.1999998092651,"responseStart":510.2999999523163,"secureConnectionStart":375.19999980926514},{"duration":138.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":375.39999985694885,"connectEnd":375.39999985694885,"connectStart":375.39999985694885,"domainLookupEnd":375.39999985694885,"domainLookupStart":375.39999985694885,"fetchStart":375.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":499.2999999523163,"responseEnd":513.6999998092651,"responseStart":511.19999980926514,"secureConnectionStart":375.39999985694885},{"duration":122.89999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":375.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":375.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":498.39999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":141.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":375.59999990463257,"connectEnd":375.59999990463257,"connectStart":375.59999990463257,"domainLookupEnd":375.59999990463257,"domainLookupStart":375.59999990463257,"fetchStart":375.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":501.19999980926514,"responseEnd":517.1999998092651,"responseStart":514,"secureConnectionStart":375.59999990463257},{"duration":123.70000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":375.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":375.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":499.5,"responseStart":0,"secureConnectionStart":0},{"duration":141.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":375.89999985694885,"connectEnd":375.89999985694885,"connectStart":375.89999985694885,"domainLookupEnd":375.89999985694885,"domainLookupStart":375.89999985694885,"fetchStart":375.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":502.69999980926514,"responseEnd":517.6999998092651,"responseStart":515.8999998569489,"secureConnectionStart":375.89999985694885},{"duration":387.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":384.5,"connectEnd":384.5,"connectStart":384.5,"domainLookupEnd":384.5,"domainLookupStart":384.5,"fetchStart":384.5,"redirectEnd":0,"redirectStart":0,"requestStart":586.0999999046326,"responseEnd":771.7999999523163,"responseStart":763.1999998092651,"secureConnectionStart":384.5},{"duration":388.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":385.2999999523163,"connectEnd":385.2999999523163,"connectStart":385.2999999523163,"domainLookupEnd":385.2999999523163,"domainLookupStart":385.2999999523163,"fetchStart":385.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":714.1999998092651,"responseEnd":774.1999998092651,"responseStart":769.5,"secureConnectionStart":385.2999999523163},{"duration":206.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":715.7999999523163,"connectEnd":715.7999999523163,"connectStart":715.7999999523163,"domainLookupEnd":715.7999999523163,"domainLookupStart":715.7999999523163,"fetchStart":715.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":887.5999999046326,"responseEnd":922.3999998569489,"responseStart":921.5999999046326,"secureConnectionStart":715.7999999523163}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":161,"responseStart":367,"responseEnd":385,"domLoading":371,"domInteractive":1081,"domContentLoadedEventStart":1081,"domContentLoadedEventEnd":1116,"domComplete":1967,"loadEventStart":1967,"loadEventEnd":1967,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1066.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1067.3999998569489},{"name":"bigPipe.activity-panel-pipe-id.start","time":1067.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1068},{"name":"activityTabFullyLoaded","time":1125.1999998092651}],"measures":[],"correlationId":"66b97924362555","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}