I want to define a table that will have 2 TIMESTAMP fields, something like this:
CREATE TABLE `msgs` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `msg` VARCHAR(256), `ts_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `ts_update` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )
How to do this avoiding the error:
ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
The point is to save the desired behavior of ts_create
and ts_update
in the table schema.
mysql timestamp mysql-error-1293
kuba 04 Feb 2018-11-11T00: 00Z
source share