Best way to monitor, control, or rewrite data definition commands?

From: "Turner, Ian" <Ian(dot)Turner(at)deshaw(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Best way to monitor, control, or rewrite data definition commands?
Date: 2009-05-12 23:59:22
Message-ID: 8744EE476651744882371AB948473F0B159E7E@mailnyc2.nyc.deshaw.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello list,

I am trying to implement automatic audit log tracking for newly created
tables. When a user creates a table, I would like to create a second
table for the audit log, along with the relevant rules. So for example,
if a user does

CREATE TABLE foo (fooid integer);

Then I would also like to do

CREATE TABLE foo_audit (fooid integer, <other columns>);

along with the creation of some other triggers, rules, etc.

Is there any way to be notified when a user executes data definition
commands such as CREATE TABLE? It doesn't appear possible to apply
triggers or rules to the system tables, and the query rewrite engine
only seems to apply to SELECT, INSERT, and UPDATE. Thoughts?

Cheers,

--Ian Turner

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2009-05-13 01:31:09 Re: Best way to monitor, control, or rewrite data definition commands?
Previous Message Adrian Klaver 2009-05-12 23:26:19 Re: pg_dump/pg_restore schema and data separately and foreign key constraints