Is it possible to have a timestamp constraint in mysql that MUST come from the system and can not otherwise be provided in the insert or update query?
Is it possible to keep a table from being updated with a constraint? I understand how to keep a mysql user from updating a table with GRANT but in my case a constraint may be preferred as it is my goal to guarantee the timestamp of the record regardless of user including root.
What you can do is to overwrite the value on
INSERTandUPDATEusing a triggerSo no matter what the query sets, the value of your desired timestamp field will always be the system time.
EDIT 1:
Just realized you actually wanted to prevent that the once set system time could be updated later.
Slightly modify your UPDATE trigger to have this job done.
SET NEW.datefield := OLD.datefieldresets the value to the old value on each update