I'm using logical replication and managed to have the trigger fire when I have the following:
CREATE TRIGGER set_updated_time_trig
AFTER INSERT OR UPDATE OR DELETE ON test
FOR EACH ROW EXECUTE FUNCTION set_updated_time();
alter table test enable always trigger set_updated_time_trig;
I tried with ALWAYS
-> REPLICA
too.
But when I use for each STATEMENT
, it is no longer working. I prefer to use for each statement
since I can add also OR TRUNCATE
.
CREATE TRIGGER set_updated_time_trig
AFTER INSERT OR UPDATE OR DELETE ON test
FOR EACH STATEMENT EXECUTE FUNCTION set_updated_time();
How can I have a trigger that is fired on Truncate?