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":1095.2999997138977,"ttfb":318,"pageVisibility":"visible","entityId":66627,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"65a376bc-7a35-4400-a814-f94c0e7b72e5","navigationType":0,"readyForUser":1196.6999998092651,"redirectCount":0,"resourceLoadedEnd":805.6999998092651,"resourceLoadedStart":332.7999997138977,"resourceTiming":[{"duration":54,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":332.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":332.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":386.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":55.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":333,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":333,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":388.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":217.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":333.19999980926514,"connectEnd":333.19999980926514,"connectStart":333.19999980926514,"domainLookupEnd":333.19999980926514,"domainLookupStart":333.19999980926514,"fetchStart":333.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":394.2999997138977,"responseEnd":550.3999996185303,"responseStart":410.7999997138977,"secureConnectionStart":333.19999980926514},{"duration":412.90000009536743,"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":333.3999996185303,"connectEnd":333.3999996185303,"connectStart":333.3999996185303,"domainLookupEnd":333.3999996185303,"domainLookupStart":333.3999996185303,"fetchStart":333.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":394.59999990463257,"responseEnd":746.2999997138977,"responseStart":415.2999997138977,"secureConnectionStart":333.3999996185303},{"duration":84.5,"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":333.69999980926514,"connectEnd":333.69999980926514,"connectStart":333.69999980926514,"domainLookupEnd":333.69999980926514,"domainLookupStart":333.69999980926514,"fetchStart":333.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":395,"responseEnd":418.19999980926514,"responseStart":417,"secureConnectionStart":333.69999980926514},{"duration":85.30000019073486,"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":333.7999997138977,"connectEnd":333.7999997138977,"connectStart":333.7999997138977,"domainLookupEnd":333.7999997138977,"domainLookupStart":333.7999997138977,"fetchStart":333.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":395.5,"responseEnd":419.09999990463257,"responseStart":418.2999997138977,"secureConnectionStart":333.7999997138977},{"duration":90,"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":333.8999996185303,"connectEnd":333.8999996185303,"connectStart":333.8999996185303,"domainLookupEnd":333.8999996185303,"domainLookupStart":333.8999996185303,"fetchStart":333.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":400.59999990463257,"responseEnd":423.8999996185303,"responseStart":422.59999990463257,"secureConnectionStart":333.8999996185303},{"duration":65.2999997138977,"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":334.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":399.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":106.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":334.2999997138977,"connectEnd":334.2999997138977,"connectStart":334.2999997138977,"domainLookupEnd":334.2999997138977,"domainLookupStart":334.2999997138977,"fetchStart":334.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":411.5,"responseEnd":441.09999990463257,"responseStart":429,"secureConnectionStart":334.2999997138977},{"duration":75,"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":334.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":409.5,"responseStart":0,"secureConnectionStart":0},{"duration":113.69999980926514,"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":334.59999990463257,"connectEnd":334.59999990463257,"connectStart":334.59999990463257,"domainLookupEnd":334.59999990463257,"domainLookupStart":334.59999990463257,"fetchStart":334.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":416.09999990463257,"responseEnd":448.2999997138977,"responseStart":446.2999997138977,"secureConnectionStart":334.59999990463257},{"duration":436.7000002861023,"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":367.7999997138977,"connectEnd":367.7999997138977,"connectStart":367.7999997138977,"domainLookupEnd":367.7999997138977,"domainLookupStart":367.7999997138977,"fetchStart":367.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":445,"responseEnd":804.5,"responseStart":788.3999996185303,"secureConnectionStart":367.7999997138977},{"duration":432.09999990463257,"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":373.59999990463257,"connectEnd":373.59999990463257,"connectStart":373.59999990463257,"domainLookupEnd":373.59999990463257,"domainLookupStart":373.59999990463257,"fetchStart":373.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":464.69999980926514,"responseEnd":805.6999998092651,"responseStart":790.7999997138977,"secureConnectionStart":373.59999990463257},{"duration":181.2999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":691.5,"connectEnd":691.5,"connectStart":691.5,"domainLookupEnd":691.5,"domainLookupStart":691.5,"fetchStart":691.5,"redirectEnd":0,"redirectStart":0,"requestStart":803.0999999046326,"responseEnd":872.7999997138977,"responseStart":839.0999999046326,"secureConnectionStart":691.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":72,"responseStart":318,"responseEnd":373,"domLoading":321,"domInteractive":1327,"domContentLoadedEventStart":1327,"domContentLoadedEventEnd":1400,"domComplete":1864,"loadEventStart":1864,"loadEventEnd":1865,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1296.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1296.7999997138977},{"name":"bigPipe.activity-panel-pipe-id.start","time":1297},{"name":"bigPipe.activity-panel-pipe-id.end","time":1300.0999999046326},{"name":"activityTabFullyLoaded","time":1419.0999999046326}],"measures":[],"correlationId":"eb9ed04402c786","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":141,"dbReadsTimeInMs":24,"dbConnsTimeInMs":34,"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.