Percona 5.6.32 :
mysql> create table test0( → id int(2) not null auto_increment, → modified timestamp not null default current_timestamp on update current_timestamp, → primary key (id) → ); Query OK, 0 rows affected (0.01 sec) mysql> show create table test0\G *************************** 1. row *************************** Table: test0 Create Table: CREATE TABLE test0
( id
int(2) NOT NULL AUTO_INCREMENT, modified
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec)
so far so good. Now:
mysql> create table test1( → id int(2) not null auto_increment, → modified timestamp(2) not null default current_timestamp on update current_timestamp, → primary key (id) → ); ERROR 1067 (42000): Invalid default value for ‘modified’
What’s more, I can create the table with a timestamp(2) column, as long as I skip the defaults, and can create separate triggers to update that column on insert/udate, but adding the current_timestamp default just fails…