Indeed an implementation fault.
The native approach in MySQL is to update a creation date yourself ( if you need one ) and have MySQL worry about the timestamp update date ? update date : creation date
like so:
CREATE TABLE tracked_data(
`data` TEXT,
`timestamp` TIMESTAMP,
`creation_date` TIMESTAMP
) ENGINE=INNODB;
On creation Insert NULL:
INSERT INTO tracked_data(`data`,`creation_date`) VALUES ('creation..',NULL);
NULL values for timestamp are interperted as CURRENT_TIMESTAMP by default.
In MySQL the first TIMESTAMP column of a table gets both DEFAULT CURRENT_TIMESTAMP
and ON UPDATE CURRENT_TIMESTAMP
attribute, if no attributes are given for it.
this is why TIMESTAMP column with attributes must come first or you get the error described in this thread.