Type:
New Feature
Priority:
Critical
Resolution:
Fixed
create table t1 as select now();
show create table t1;
returns
+-------+----------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------+
| t1 | CREATE TABLE `t1` (
`now()` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------+
should be timestamp.
These functions should also return TIMESTAMP:
FROM_UNIXTIME()
SYSDATE()
Note, the function LOCALTIMESTAMP() according to the SQL Standard returns TIMESTAMP WITHOUT TIME ZONE, therefore we'll keep its return type as DATETIME.
This change is (among other things) expected to fix the following problem:
SET time_zone= 'Europe/Moscow' ;
CREATE OR REPLACE TABLE t1 (a TIMESTAMP );
SET timestamp =1288477526 /*summer time in Moscow*/ ;
INSERT INTO t1 VALUES ( CURRENT_TIMESTAMP ()), ( COALESCE ( CURRENT_TIMESTAMP ()));
SET timestamp =1288477526+3599 /*winter time in Moscow*/ ;
INSERT INTO t1 VALUES ( CURRENT_TIMESTAMP ()), ( COALESCE ( CURRENT_TIMESTAMP ()));
SELECT a, UNIX_TIMESTAMP(a) FROM t1;
DROP TABLE t1;
+---------------------+-------------------+
| a | UNIX_TIMESTAMP(a) |
+---------------------+-------------------+
| 2010-10-31 02:25:26 | 1288477526 |
| 2010-10-31 02:25:26 | 1288477526 |
| 2010-10-31 02:25:25 | 1288481125 | <-- this value is good
| 2010-10-31 02:25:25 | 1288477525 | <-- this value is wrong
+---------------------+-------------------+
Notice, on the second INSERT statement (soon after DST fallback), CURRENT_TIMESTAMP() and COALESCE(CURRENT_TIMESTAMP()) inserted different values because:
Insertion of CURRENT_TIMESTAMP() works in TIMESTAMP format due to a hack in Item_func_now_local::save_in_field
Insertion of COALESCE(CURRENT_TIMESTAMP()) works in DATETIME format.
After the change COALESCE(CURRENT_TIMESTAMP()) is expected to insert the same value with CURRENT_TIMESTAMP().
{"report":{"fcp":848.8000001907349,"ttfb":229.9000005722046,"pageVisibility":"visible","entityId":66627,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":1,"journeyId":"771b54d0-fb68-4667-a7a5-dce6b7634812","navigationType":0,"readyForUser":948.1999998092651,"redirectCount":0,"resourceLoadedEnd":838.6000003814697,"resourceLoadedStart":235.60000038146973,"resourceTiming":[{"duration":20.59999942779541,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":235.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":256.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":21,"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":235.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":256.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":74,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":236,"connectEnd":236,"connectStart":236,"domainLookupEnd":236,"domainLookupStart":236,"fetchStart":236,"redirectEnd":0,"redirectStart":0,"requestStart":236,"responseEnd":310,"responseStart":310,"secureConnectionStart":236},{"duration":164.4000005722046,"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":236.19999980926514,"connectEnd":236.19999980926514,"connectStart":236.19999980926514,"domainLookupEnd":236.19999980926514,"domainLookupStart":236.19999980926514,"fetchStart":236.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":236.19999980926514,"responseEnd":400.6000003814697,"responseStart":400.6000003814697,"secureConnectionStart":236.19999980926514},{"duration":169,"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":236.30000019073486,"connectEnd":236.30000019073486,"connectStart":236.30000019073486,"domainLookupEnd":236.30000019073486,"domainLookupStart":236.30000019073486,"fetchStart":236.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":236.30000019073486,"responseEnd":405.30000019073486,"responseStart":405.30000019073486,"secureConnectionStart":236.30000019073486},{"duration":169.5,"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":236.4000005722046,"connectEnd":236.4000005722046,"connectStart":236.4000005722046,"domainLookupEnd":236.4000005722046,"domainLookupStart":236.4000005722046,"fetchStart":236.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":236.4000005722046,"responseEnd":405.9000005722046,"responseStart":405.9000005722046,"secureConnectionStart":236.4000005722046},{"duration":169.70000076293945,"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":236.69999980926514,"connectEnd":236.69999980926514,"connectStart":236.69999980926514,"domainLookupEnd":236.69999980926514,"domainLookupStart":236.69999980926514,"fetchStart":236.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":236.69999980926514,"responseEnd":406.4000005722046,"responseStart":406.4000005722046,"secureConnectionStart":236.69999980926514},{"duration":221.80000019073486,"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":236.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":458.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":170.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":236.9000005722046,"connectEnd":236.9000005722046,"connectStart":236.9000005722046,"domainLookupEnd":236.9000005722046,"domainLookupStart":236.9000005722046,"fetchStart":236.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":236.9000005722046,"responseEnd":407.4000005722046,"responseStart":407.4000005722046,"secureConnectionStart":236.9000005722046},{"duration":221.60000038146973,"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":237.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":458.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":171.60000038146973,"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":237.30000019073486,"connectEnd":237.30000019073486,"connectStart":237.30000019073486,"domainLookupEnd":237.30000019073486,"domainLookupStart":237.30000019073486,"fetchStart":237.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":237.30000019073486,"responseEnd":408.9000005722046,"responseStart":408.9000005722046,"secureConnectionStart":237.30000019073486},{"duration":437.69999980926514,"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":251.60000038146973,"connectEnd":251.60000038146973,"connectStart":251.60000038146973,"domainLookupEnd":251.60000038146973,"domainLookupStart":251.60000038146973,"fetchStart":251.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":251.60000038146973,"responseEnd":689.3000001907349,"responseStart":689.3000001907349,"secureConnectionStart":251.60000038146973},{"duration":571.1999998092651,"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":259.30000019073486,"connectEnd":259.30000019073486,"connectStart":259.30000019073486,"domainLookupEnd":259.30000019073486,"domainLookupStart":259.30000019073486,"fetchStart":259.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":259.30000019073486,"responseEnd":830.5,"responseStart":830.5,"secureConnectionStart":259.30000019073486},{"duration":220,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":469.9000005722046,"connectEnd":469.9000005722046,"connectStart":469.9000005722046,"domainLookupEnd":469.9000005722046,"domainLookupStart":469.9000005722046,"fetchStart":469.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":469.9000005722046,"responseEnd":689.9000005722046,"responseStart":689.9000005722046,"secureConnectionStart":469.9000005722046},{"duration":102.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/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&whisper-enabled=true","startTime":735.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":735.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":838.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":373.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/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&whisper-enabled=true","startTime":736.8000001907349,"connectEnd":736.8000001907349,"connectStart":736.8000001907349,"domainLookupEnd":736.8000001907349,"domainLookupStart":736.8000001907349,"fetchStart":736.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":736.8000001907349,"responseEnd":1110.6000003814697,"responseStart":1110.6000003814697,"secureConnectionStart":736.8000001907349}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":50,"responseStart":230,"responseEnd":261,"domLoading":234,"domInteractive":1025,"domContentLoadedEventStart":1025,"domContentLoadedEventEnd":1091,"domComplete":1480,"loadEventStart":1480,"loadEventEnd":1481,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":999.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1000.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1000.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1002.1000003814697},{"name":"activityTabFullyLoaded","time":1110.6000003814697}],"measures":[],"correlationId":"9daf4e5106ba80","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":113,"dbReadsTimeInMs":18,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
According to the standard, it should return TIMESTAMP WITH TIMEZONE:
While, the best name for MariaDB's TIMESTAMP is "TIMESTAMP WITH LOCAL TIME ZONE".
So perhaps we should implement MDEV-10018 first.