Re: Database Design: Maintain Audit Trail of Changes - Mailing list pgsql-general

From Craig Ringer
Subject Re: Database Design: Maintain Audit Trail of Changes
Date
Msg-id 50EBAF88.4060402@2ndquadrant.com
Whole thread Raw
In response to Re: Database Design: Maintain Audit Trail of Changes  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Database Design: Maintain Audit Trail of Changes  (Stevo Slavić <sslavic@gmail.com>)
List pgsql-general
On 4/01/2013 12:09 AM, Adrian Klaver wrote:
> On 01/03/2013 07:38 AM, Rich Shepard wrote:
>
>>
>>    The middleware of the application needs to check this table when data
>> are
>> to be viewed in the UI and present only the current row contents. A
>> separate
>> view would display a history of changes for that row.
>>
>>    All thoughts, suggestions, and recommendations based on your
>> expertise and
>> experience will be most welcome.
>
> As a matter of course I include fields to record the timestamp and
> user for insert of records and last update of record on my tables.
>
> For a relatively simple solution see this blog post I put up this summer:
>
> http://aklaver.org/wordpress/2012/06/23/postgres-and-hstore/
>
> I have since expanded that to include updates by using TG_OP to
> determine the operation being done on the table.
>
> There is also pg_audit
> :
> https://github.com/jcasanov/pg_audit

Additionally, this is an audit trigger I was using internally and
generalized:

http://wiki.postgresql.org/wiki/Audit_trigger_91plus

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: PostgreSQL run as process in windows
Next
From: Craig Ringer
Date:
Subject: Re: Unnecessary files that can be deleted/moved in cluster dir?