[MDEV-14556] inconsistent NOW behavior DEFAULT/ASOF Created: 2017-12-02  Updated: 2018-02-14

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.2
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Sergei Golubchik Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-12894 System-versioned tables Closed

 Description   

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.


Generated at Thu Feb 08 08:14:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.