Trigger function to audit any kind of table

From: "Sergio Duran" <sergioduran(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Trigger function to audit any kind of table
Date: 2006-06-06 18:54:01
Message-ID: c44353520606061154r242f63abrcba5c29a39891f3c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I would like to know if it is possible to create a trigger function which
does something like

CREATE OR REPLACE FUNCTION table_audit() RETURNS TRIGGER AS $table_audit$
BEGIN
INSERT INTO audit SELECT TG_OP, current_timestampmp, current_user, OLD,
NEW;
RETURN NEW;
END $table_audit$ LANGUAGE plpgsql;

Can I create a table with those two RECORD pseudo-types or something
compatible?

I'm using pgsql 8.1

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2006-06-06 19:21:04 Re: Backwards index scan
Previous Message shakahshakah@gmail.com 2006-06-06 18:24:04 autovacuum, xid wraparound, pg_database column values