[MDEV-5994] MySQL WL#6292 - Make TIMESTAMP columns nullable by default Created: 2014-04-01  Updated: 2015-10-30  Resolved: 2015-10-30

Status: Closed
Project: MariaDB Server
Component/s: Temporal Types
Fix Version/s: 10.1.8

Type: Task Priority: Minor
Reporter: Sergey Vojtovich Assignee: Alexander Barkov
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-3929 Add system variable explicit_defaults... Closed
PartOf
is part of MDEV-4784 merge test cases from 5.6 Stalled

 Description   

Found while attempting to merge main.type_timestamp_explicit:

    revno: 3690.68.37
    committer: Gopal Shankar <gopal.shankar@oracle.com>
    branch nick: mysql-trunk-wl6292-push
    timestamp: Thu 2012-06-21 08:27:40 +0530
    message:
      WL#6292 - Make TIMESTAMP columns nullable by default.
 
      This worklog implements new behavior for TIMESTAMP columns,
      defined by CREATE TABLE, ALTER TABLE and CREATE SELECT commands.
      This is in effort to make TIMESTAMP columns behavior to be
      more closer to SQL standard. The change in behavior is as
      described below,
 
      Current behavior:
      =================
        1) Unlike all the other types, TIMESTAMP columns which are not
           explicitly specified as NULLable automatically get NOT NULL
           as attribute.
        2) If the first TIMESTAMP column in table is not specified as
           NULLable and doesn't have explicit DEFAULT or ON UPDATE
           value specified it automatically gets DEFAULT NOW()
           ON UPDATE NOW() as attributes.
        3) All other TIMESTAMP columns which are not NULLable and
           don't have explicit default specified get '0' as default
           value and treated as having explicit default value after
           that (i.e. if you don't provide explicit value for such
           a column when inserting into table no warning or error
           is emitted).
 
      New behavior:
      =============
        1) TIMESTAMP columns which are not explicitly specified as
           NOT NULL become NULLable.
        2) No TIMESTAMP columns get DEFAULT NOW() or ON UPDATE NOW()
           attributes automatically, without them being explicitly
           specified.
        3) Non-NULLable TIMESTAMP columns without explicit default
           value treated as having no default value. I.e. warning
           or error is emitted (depends on sql_mode) if we insert
           a row without providing and explicit value for such a
           column. In case when warning is emitted and not an
           error such a column will still get '0' if no explicit
           value was specified for it.
 
      A new command line option '--explicit_defaults_for_timestamp'
      is introduced for MySQL server to enable new behavior. The old
      behavior is kept as default, so that the existing applications
      assuming old semantics work without any changes.
 
      Replication slave applier thread is extended with new interface,
      such that the slave applies the logs with old behavior, if the
      logs are generated by master with older version than slave.
 
      MySQL system table definitions at scripts/* were updated,
      such that they work fine with old and new behavior with
      any change. MTR tests which use TIMESTAMP columns are also
      updated, such that the test works both in old and new
      behavior. This should help easy transition to new behavior
      going forward.
 
      This worklog addresses Bug#11762529 and Bug#13344629.



 Comments   
Comment by Sergei Golubchik [ 2015-10-30 ]

Covered by MDEV-3929

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