Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14556

inconsistent NOW behavior DEFAULT/ASOF

    XMLWordPrintable

Details

    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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.