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