Re: Select Column Auditing/Logging

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Jeremy Brown <jwbrown77(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Select Column Auditing/Logging
Date: 2009-07-22 21:44:29
Message-ID: 1248299069.23273.18.camel@monkey-cat.sm.truviso.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2009-07-22 at 14:41 -0700, Jeff Davis wrote:
> On Wed, 2009-07-22 at 12:04 -0700, Jeremy Brown wrote:
> > It seems that PostgreSQL can audit INSERT, UPDATE, DELETE, and
> > TRUNCATE through the use of triggers. But SELECT triggers are
> > unsupported (it does suggest perhaps using RULES).
>
> One thing you can do is use a set-returning function that, as a side
> effect, records what happened.

I should warn you not to record it in a transactional way: it must go
out to an external service, or go back to postgresql using something
like dblink. Otherwise, someone could do:

BEGIN;
SELECT ...;
ROLLBACK;

and whatever you logged would be gone.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert James 2009-07-22 22:15:05 Help using SELECT INTO to make schema
Previous Message Jeff Davis 2009-07-22 21:41:41 Re: Select Column Auditing/Logging