On Mon, Mar 28, 2011 at 10:19 AM, Shridhar Polas
> Is there a way to create triggers on system catalog tables like
> pg_class, pg_attribute etc...?
No, this isn't supported, and, since the normal alterations of the
schema involve manipulating these tables, such an addition would be
fraught with the risk of breaking system behavior.
- Your trigger function needs to be aware of *ALL* functionalities
that involve those tables.
For instance, a trigger on pg_class needs to be able to cope with
changes relating to views, sequences, inherited tables, not just its
use for tables.
- There are liable to be timing issues, as a series of updates to
these tables won't in general be consistent until *all* the updates
E.g. - consider that when a table is created, there'd be an insert
to pg_class, and then, later, inserts to pg_attribute. A trigger
firing against pg_class would capture a partially-completed table
creation, which mayn't be what you were expecting.
A proposal to adding triggers to system catalog tables won't be
In response to
pgsql-hackers by date
|Next:||From: Noah Misch||Date: 2011-03-29 18:29:33|
|Subject: Re: deadlock_timeout at < PGC_SIGHUP?|
|Previous:||From: Gurjeet Singh||Date: 2011-03-29 17:41:41|
|Subject: Re: Triggers on system catalog|