MySQL Forums
Forum List  »  InnoDB

Re: Invalid default value
Posted by: Peter Brawley
Date: August 13, 2014 01:01PM

You might've been even more specific, absent that you'll need to find your case in this ...

Before 5.6.5: Timestamps could be NULLed only if created as TIMESTAMP NULL and were otherwise autodeclared NOT NULL. They took zero or valid DATETIME values. One TIMESTAMP column per table could be defaulted on INSERT or UPDATE. If there was no explicit default, the first TIMESTAMP was autoassigned DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, and subsequent TIMESTAMPs were autoassigned DEFAULT ‘0000-00-00 00:00:00’.

Since 5.6.5: Any number of TIMESTAMP columns can be defined with any combination of DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP. DEFAULT <constant> and ON UPDATE <constant> apply <constant> on INSERT and UPDATE respectively.

Since 5.6.6: If the new system variable explicit_defaults_for_timestamp is set ON, TIMESTAMPs not explicitly declared NOT NULL accept NULLs, no TIMESTAMP column is autoassigned DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, and TIMESTAMPs declared NOT NULL without a DEFAULT clause have no default value (if sql_mode is strict, an error occurs).

Options: ReplyQuote


Subject
Views
Written By
Posted
2840
August 13, 2014 12:34PM
994
August 13, 2014 12:40PM
Re: Invalid default value
1666
August 13, 2014 01:01PM
1316
August 13, 2014 02:12PM
871
August 14, 2014 11:31AM
925
August 14, 2014 12:29PM
923
August 14, 2014 02:43PM
845
August 15, 2014 09:58PM
1415
August 15, 2014 10:39PM
888
August 16, 2014 05:15AM
979
August 16, 2014 07:56AM
862
August 16, 2014 05:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.