mysql - Why does the TIMESTAMP column require "NULL" to accept null values? -
i've googled bit , can't find on it.
why mysql column type "timestamp" require "null" parameter accept null values, when other column types dont?
also, column type requires "null" parameter accept null values?
thank you.
this related system variable added in 5.6.6 , later, explicit_defaults_for_timestamp
. default behavior is:
timestamp columns not explicitly declared null attribute assigned not null attribute. (columns of other data types, if not explicitly declared not null, permit null values.) setting such column null sets current timestamp.
the first timestamp column in table, if not declared null attribute or explicit default or on update clause, automatically assigned default current_timestamp , on update current_timestamp attributes.
timestamp columns following first one, if not declared null attribute or explicit default clause, automatically assigned default '0000-00-00 00:00:00' (the “zero” timestamp). inserted rows specify no explicit value such column, column assigned '0000-00-00 00:00:00' , no warning occurs.
setting variable makes timestamp
columns behave other columns. plan in future release non-standard behavior removed entirely, , variable deprecated.
Comments
Post a Comment