Featured post
mysql - Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause? -
why there can 1 timestamp column current_timestamp in default or on update clause?
create table `foo` ( `productid` int(10) unsigned not null, `addeddate` timestamp not null default current_timestamp, `updateddate` timestamp not null default current_timestamp on update current_timestamp ) engine=innodb;
the error results:
error code : 1293
incorrect table definition; there can 1 timestamp column current_timestamp in default or on update clause
this limitation, due historical, code legacy reasons, has been lifted in recent versions of mysql:
changes in mysql 5.6.5 (2012-04-10, milestone 8)
previously, @ 1 timestamp column per table automatically initialized or updated current date , time. restriction has been lifted. timestamp column definition can have combination of default current_timestamp , on update current_timestamp clauses. in addition, these clauses can used datetime column definitions. more information, see automatic initialization , updating timestamp , datetime.
http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html
- Get link
- X
- Other Apps
Comments
Post a Comment