Re: Triggers on system catalog

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: Triggers on system catalog
Дата
Msg-id AANLkTin7=5rsnErzGDscRWc1kv_TnLA9PyHo_vBEudGa@mail.gmail.com
обсуждение исходный текст
Ответ на Triggers on system catalog  (Shridhar Polas <shridharpolas@gmail.com>)
Ответы Re: Triggers on system catalog  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Mon, Mar 28, 2011 at 10:19 AM, Shridhar Polas
<shridharpolas@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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gurjeet Singh
Дата:
Сообщение: Re: Triggers on system catalog
Следующее
От: Noah Misch
Дата:
Сообщение: Re: deadlock_timeout at < PGC_SIGHUP?