I am about to implement an audit system in my database and am looking for the most effective way to do this.
I've read the wiki and did my research.
There is this example: https://wiki.postgresql.org/wiki/Audit_trigger And also this: https://wiki.postgresql.org/wiki/Audit_trigger_91plus
In the listed examples you have to create a trigger for each table (kinda redudant).
However with Postgres 9.3+ we have the ability of event triggers where we can react on special events like create, alter or drop table.
An optimal solution would be:
create event trigger UpdateTables
on ddl_command_end
when tag in ( 'insert ', 'update ')
execute procedure DoAudit();
However that returns:
ERROR: filter value "insert " not recognized for filter variable "tag" SQL Status:42601
I am wondering if we also can react on insert, update events with event triggers and use this single trigger for all auditing?