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/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general