ON UPDATE behavior

Is the [ON UPDATE <update_value>] only available to datetime/timestamp columns?

When trying to modify a column (also happens with CREATE TABLE), I get an error:

alter table keywords modify column indexed tinyint(1) unsigned not null default 0 on update 0;

ERROR 1064 ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘0’ at line 1

The documentation is not entirely clear about supported data types.

The behaviour is helpful to CDC functionality. I’m also testing nullable timestamps, but they consume more disk space than integers.

My experiments seem to show that the ON UPDATE must be use on timestamp/datetime[(6)] types and you can only use one of the time functions as the argument. The docs say these work, but should also say that no other combinations work. I’ll double check this and file an update ticket for the docs.

Thanks for the confirmation @hanson

I’ll stick to timestamps for now.