CREATE TABLE t1 (
a TIMESTAMP (6) DEFAULT NOW(),
b TIMESTAMP (6) DEFAULT NOW(0),
c TIMESTAMP (6) DEFAULT (NOW() + INTERVAL 1 DAY )
);
SHOW CREATE TABLE t1;
first column: NOW() becomes NOW(6) , second column: NOW(0) becomes NOW(6) , third column: NOW() becomes NOW(0) . Same with CURRENT_TIMESTAMP , same in AS OF .
Suggested solution: implement sql standard behavior, where CURRENT_TIMESTAMP() means CURRENT_TIMESTAMP(6) . According to SQL:2016, Part 2, Section 6.1 <data type>, Syntax Rules:
36) If <time precision> is not specified, then 0 (zero) is implicit. If <timestamp precision> is not specified, then 6 is implicit.
Perhaps we'll do an old_mode setting of DEFAULT_NOW_0 to let users to revert to the old behavior temporarily.
is part of
MDEV-12894
System-versioned tables
Closed
Sergei Golubchik
made changes -
2017-12-02 14:54
Field
Original Value
New Value
Fix Version/s
10.3
[ 22126
]
Sergei Golubchik
made changes -
2017-12-02 15:04
Description
{code:sql}
CREATE TABLE t1 (
a TIMESTAMP(6) DEFAULT NOW(),
b TIMESTAMP(6) DEFAULT NOW(0),
c TIMESTAMP(6) DEFAULT (NOW() + INTERVAL 1 DAY)
);
SHOW CREATE TABLE t1;
{code}
first column: {{NOW()}} becomes {{NOW(6)}}, second column: {{NOW(0)}} becomes {{NOW(6)}}, third column: {{NOW()}} becomes {{NOW(0)}}. Same with {{CURRENT_TIMESTAMP}}, same with {{AS OF}}.
*Suggested solution:* implement sql standard behavior, where {{CURRENT_TIMESTAMP()}} means {{CURRENT_TIMESTAMP(6)}}. According to SQL:2016, Part 2, Section 6.1 <data type>, Syntax Rules:
bq. 36) If <time precision> is not specified, then 0 (zero) is implicit. If <timestamp precision> is not specified, then 6 is implicit.
Perhaps we'll do an {{old_mode}} setting of {{DEFAULT_NOW_0}} to let users to revert to the old behavior temporarily.
Sergei Golubchik
made changes -
2017-12-02 15:24
Description
{code:sql}
CREATE TABLE t1 (
a TIMESTAMP(6) DEFAULT NOW(),
b TIMESTAMP(6) DEFAULT NOW(0),
c TIMESTAMP(6) DEFAULT (NOW() + INTERVAL 1 DAY)
);
SHOW CREATE TABLE t1;
{code}
first column: {{NOW()}} becomes {{NOW(6)}}, second column: {{NOW(0)}} becomes {{NOW(6)}}, third column: {{NOW()}} becomes {{NOW(0)}}. Same with {{CURRENT_TIMESTAMP}}, same with {{AS OF}}.
*Suggested solution:* implement sql standard behavior, where {{CURRENT_TIMESTAMP()}} means {{CURRENT_TIMESTAMP(6)}}. According to SQL:2016, Part 2, Section 6.1 <data type>, Syntax Rules:
bq. 36) If <time precision> is not specified, then 0 (zero) is implicit. If <timestamp precision> is not specified, then 6 is implicit.
Perhaps we'll do an {{old_mode}} setting of {{DEFAULT_NOW_0}} to let users to revert to the old behavior temporarily.
{code:sql}
CREATE TABLE t1 (
a TIMESTAMP(6) DEFAULT NOW(),
b TIMESTAMP(6) DEFAULT NOW(0),
c TIMESTAMP(6) DEFAULT (NOW() + INTERVAL 1 DAY)
);
SHOW CREATE TABLE t1;
{code}
first column: {{NOW()}} becomes {{NOW(6)}}, second column: {{NOW(0)}} becomes {{NOW(6)}}, third column: {{NOW()}} becomes {{NOW(0)}}. Same with {{CURRENT_TIMESTAMP}}, same in {{AS OF}}.
*Suggested solution:* implement sql standard behavior, where {{CURRENT_TIMESTAMP()}} means {{CURRENT_TIMESTAMP(6)}}. According to SQL:2016, Part 2, Section 6.1 <data type>, Syntax Rules:
bq. 36) If <time precision> is not specified, then 0 (zero) is implicit. If <timestamp precision> is not specified, then 6 is implicit.
Perhaps we'll do an {{old_mode}} setting of {{DEFAULT_NOW_0}} to let users to revert to the old behavior temporarily.
Sergei Golubchik
made changes -
2021-12-06 21:33
Workflow
MariaDB v3
[ 84245
]
MariaDB v4
[ 140554
]
{"report":{"fcp":1119.1000000238419,"ttfb":522.5,"pageVisibility":"visible","entityId":64645,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"082472ed-ea7f-4f34-8359-e75f8eaf352a","navigationType":0,"readyForUser":1194.1000000238419,"redirectCount":0,"resourceLoadedEnd":1475,"resourceLoadedStart":529.6000000238419,"resourceTiming":[{"duration":108.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":529.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":529.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":638,"responseStart":0,"secureConnectionStart":0},{"duration":108.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":529.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":529.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":638.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":117.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":530.1000000238419,"connectEnd":530.1000000238419,"connectStart":530.1000000238419,"domainLookupEnd":530.1000000238419,"domainLookupStart":530.1000000238419,"fetchStart":530.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":530.1000000238419,"responseEnd":647.1999999284744,"responseStart":647.1999999284744,"secureConnectionStart":530.1000000238419},{"duration":160.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":530.2999999523163,"connectEnd":530.2999999523163,"connectStart":530.2999999523163,"domainLookupEnd":530.2999999523163,"domainLookupStart":530.2999999523163,"fetchStart":530.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":530.2999999523163,"responseEnd":690.7999999523163,"responseStart":690.7999999523163,"secureConnectionStart":530.2999999523163},{"duration":163.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":530.6000000238419,"connectEnd":530.6000000238419,"connectStart":530.6000000238419,"domainLookupEnd":530.6000000238419,"domainLookupStart":530.6000000238419,"fetchStart":530.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":530.6000000238419,"responseEnd":694.3999999761581,"responseStart":694.3999999761581,"secureConnectionStart":530.6000000238419},{"duration":164.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":530.7999999523163,"connectEnd":530.7999999523163,"connectStart":530.7999999523163,"domainLookupEnd":530.7999999523163,"domainLookupStart":530.7999999523163,"fetchStart":530.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":530.7999999523163,"responseEnd":695.3999999761581,"responseStart":695.3999999761581,"secureConnectionStart":530.7999999523163},{"duration":165.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":530.8999999761581,"connectEnd":530.8999999761581,"connectStart":530.8999999761581,"domainLookupEnd":530.8999999761581,"domainLookupStart":530.8999999761581,"fetchStart":530.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":530.8999999761581,"responseEnd":696.6000000238419,"responseStart":696.6000000238419,"secureConnectionStart":530.8999999761581},{"duration":263.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":531.1999999284744,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":531.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":794.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":166.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":531.2999999523163,"connectEnd":531.2999999523163,"connectStart":531.2999999523163,"domainLookupEnd":531.2999999523163,"domainLookupStart":531.2999999523163,"fetchStart":531.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":531.2999999523163,"responseEnd":697.8999999761581,"responseStart":697.7999999523163,"secureConnectionStart":531.2999999523163},{"duration":262.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":531.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":531.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":794.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":168.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":531.6999999284744,"connectEnd":531.6999999284744,"connectStart":531.6999999284744,"domainLookupEnd":531.6999999284744,"domainLookupStart":531.6999999284744,"fetchStart":531.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":531.6999999284744,"responseEnd":699.7999999523163,"responseStart":699.7999999523163,"secureConnectionStart":531.6999999284744},{"duration":940.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":532.7999999523163,"connectEnd":532.7999999523163,"connectStart":532.7999999523163,"domainLookupEnd":532.7999999523163,"domainLookupStart":532.7999999523163,"fetchStart":532.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":532.7999999523163,"responseEnd":1473.2999999523163,"responseStart":1473.2999999523163,"secureConnectionStart":532.7999999523163},{"duration":939.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":532.7999999523163,"connectEnd":532.7999999523163,"connectStart":532.7999999523163,"domainLookupEnd":532.7999999523163,"domainLookupStart":532.7999999523163,"fetchStart":532.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":532.7999999523163,"responseEnd":1472.5,"responseStart":1472.5,"secureConnectionStart":532.7999999523163},{"duration":128.40000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":821.6999999284744,"connectEnd":821.6999999284744,"connectStart":821.6999999284744,"domainLookupEnd":821.6999999284744,"domainLookupStart":821.6999999284744,"fetchStart":821.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":821.6999999284744,"responseEnd":950.1000000238419,"responseStart":950.1000000238419,"secureConnectionStart":821.6999999284744},{"duration":404.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/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":1070.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1070.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1475,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":343,"responseStart":522,"responseEnd":528,"domLoading":526,"domInteractive":1503,"domContentLoadedEventStart":1503,"domContentLoadedEventEnd":1545,"domComplete":2174,"loadEventStart":2175,"loadEventEnd":2175,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1480.1000000238419},{"name":"bigPipe.sidebar-id.end","time":1481},{"name":"bigPipe.activity-panel-pipe-id.start","time":1481.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":1483.1000000238419},{"name":"activityTabFullyLoaded","time":1559.8999999761581}],"measures":[],"correlationId":"c7dceef63a0b12","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":121,"dbReadsTimeInMs":21,"dbConnsTimeInMs":31,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}