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

Change default of explicit_defaults_for_timestamp to ON

    XMLWordPrintable

    Details

      Description

      Users new to MariaDB often struggle with the default behavior of MariaDB regarding the datatype timestamp and automatic values https://mariadb.com/kb/en/timestamp/#automatic-values

      explicit_defaults_for_timestamp , currently set to OFF by default, should be ON by default.

      At the same time it should be checked if the variable can become a dynamic variable and if the scope SESSION can be added.

      In effect:
      With explicit_defaults_for_timestamp=OFF (default):

      MariaDB> CREATE TABLE t1 (a timestamp);
      MariaDB> SHOW CREATE TABLE t1;
       
      CREATE TABLE `t1` (
        `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
      ) ...
      

      With explicit_defaults_for_timestamp=ON the result would be:

      CREATE TABLE `t1` (
        `a` timestamp NULL DEFAULT NULL
      ) ...
      

      MySQL did it in 8.0.2

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              ralf.gebhardt@mariadb.com Ralf Gebhardt
              Votes:
              3 Vote for this issue
              Watchers:
              6 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.