Re: Best way to monitor, control, or rewrite data definition commands? - Mailing list pgsql-general

From Greg Smith
Subject Re: Best way to monitor, control, or rewrite data definition commands?
Date
Msg-id alpine.GSO.2.01.0905122142430.7859@westnet.com
Whole thread Raw
In response to Best way to monitor, control, or rewrite data definition commands?  ("Turner, Ian" <Ian.Turner@deshaw.com>)
Responses Re: Best way to monitor, control, or rewrite data definition commands?
List pgsql-general
On Tue, 12 May 2009, Turner, Ian wrote:

> 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?

This topic really deserves a FAQ entry.

You can set "log_statement=ddl" and see a log of them that way:
http://www.postgresql.org/docs/8.3/static/runtime-config-logging.html#GUC-LOG-STATEMENT

Setup CSV format logs and you can even import that into a database table,
appropriate log rotation is needed to give you breakpoints to import at
though.

The other common idiom here to detect changes is to save the output from
"pgdump -s" regularly and look for changes via diff.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

pgsql-general by date:

Previous
From: "Turner, Ian"
Date:
Subject: Best way to monitor, control, or rewrite data definition commands?
Next
From: John DeSoi
Date:
Subject: Re: Best way to monitor, control, or rewrite data definition commands?