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

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: "Turner, Ian" <Ian(dot)Turner(at)deshaw(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Best way to monitor, control, or rewrite data definition commands?
Date: 2009-05-13 01:49:38
Message-ID: alpine.GSO.2.01.0905122142430.7859@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Henry 2009-05-13 07:42:37 Re: Cannot login for short period of time
Previous Message John DeSoi 2009-05-13 01:31:09 Re: Best way to monitor, control, or rewrite data definition commands?