On Mon, Mar 28, 2011 at 10:19 AM, Shridhar Polas <shridharpo...@gmail.com> wrote: > Hi, > 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 are done. 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 terribly popular. -- http://linuxfinances.info/info/postgresql.html -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers