Re: Triggers on system catalog

Jan Wieck <janwieck@yahoo.com>

From: Jan Wieck <JanWieck@Yahoo.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>, Christopher Browne <cbbrowne@gmail.com>, Shridhar Polas <shridharpolas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2011-03-30T20:45:10Z
Lists: pgsql-hackers
On 3/30/2011 9:49 AM, Robert Haas wrote:
> On Tue, Mar 29, 2011 at 9:40 PM, Stephen Frost<sfrost@snowman.net>  wrote:
>>  * Robert Haas (robertmhaas@gmail.com) wrote:
>>>  I do think we need some kind way of capturing DDL events, though. I wonder if the object-access-hook stuff KaiGai and I did to support SE-PostgreSQL could be extended to meet this need...
>>
>>  My inclination would be 'probably', but it's not likely to really be the
>>  way we'd want to provide generalized DDL triggers..
>
> I guess I was imagining that DDL triggers would be primarily important
> for things like Slony, that are already writing C code anyway, but
> maybe that's overly optimistic...
>

Slony is using C code in every performance critical path. Other than 
that, we are perfectly happy with PL/pgSQL code.

What I would envision for DDL triggers is that they first don't fire on 
an object type, but rather on a command completion code, like "CREATE 
TABLE" or "DROP SCHEMA".

To do anything useful with that of course would require that all DDL 
does go through tcop's ProcessUtility and actually synthesizes a proper 
Utility parsetree. That isn't the case today, so there would be some 
previous clean up work to be done.


Jan

-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin