Casecommons / pg_audit_log

Create a trigger-based audit log for PostgreSQL
MIT License
3 stars 2 forks source link

Switch or make optional use of temporary table/function instead of custom variable #1

Closed pivotal-casebook closed 12 years ago

pivotal-casebook commented 12 years ago

As suggested by Heroku's database staff:

CREATE TEMPORARY TABLE audit (user_id integer, user_name text);

In this audit table you can opt to store exactly one row. One can ensure this by running the following as a unit: TRUNCATE audit; INSERT INTO audit VALUES (5, 'daniel');

Then, one can change the trigger to reference that table.

That's the gist of it. Here are embellishments and additional thoughts that may involve more invasive but also potentially helpful changes to the module:

schubert commented 12 years ago

Done. https://github.com/Casecommons/pg_audit_log/commit/eb3d5087a43bd8d0b1a1afb653245d338444cf11