[
From Lorenzo Alberton]
This tutorial discusses how to log the changes to a table that you want to monitor into an audit table, with the following information:
- the timestamp of the event
- the user who caused the event
- the table and field names
- the name and value of the PK of the affected record
- the event type
- the old and new values of the field
The article includes the full code, with the necessary triggers and functions.
The article continues at
http://www.alberton.info/postgresql_table_audit.html