# Is there a cleaner way to store fractional seconds in update times?

**URL:** <https://forums.percona.com/t/is-there-a-cleaner-way-to-store-fractional-seconds-in-update-times/5195>\
**Category:** Percona Server for MySQL 5.6\
**Created:** [November 7, 2016, 8:09pm UTC](https://forums.percona.com/t/is-there-a-cleaner-way-to-store-fractional-seconds-in-update-times/5195 "2016-11-07T20:09:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuple](https://avatars.discourse-cdn.com/v4/letter/t/da6949/32.png) [@tuple](https://forums.percona.com/u/tuple)\
**Post date:** [November 7, 2016, 8:09pm UTC](https://forums.percona.com/t/is-there-a-cleaner-way-to-store-fractional-seconds-in-update-times/5195/1 "2016-11-07T20:09:06Z")

</div>

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…
