From: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Select Column Auditing/Logging |
Date: | 2009-07-22 22:58:16 |
Message-ID: | 20090722225815.GV5407@samason.me.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jul 22, 2009 at 02:41:41PM -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. It's not ideal because it hides a lot of
> information from the optimizer, but if your table is small enough it
> would work.
Would something like this be more amenable to optimization:
CREATE FUNCTION tbl_auditor() RETURNS BOOLEAN IMMUTABLE AS $$
logquery;
RETURN TRUE; $$;
CREATE VIEW tbl_view AS
SELECT * FROM tbl WHERE tbl_auditor();
--
Sam http://samason.me.uk/
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2009-07-22 23:04:04 | Re: Best practices for moving UTF8 databases |
Previous Message | Robert James | 2009-07-22 22:50:07 | Re: Can LIKE under utf8 use INDEXes? |