Re: no cascade triggers?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: no cascade triggers?
Дата
Msg-id 18896.1182869308@sss.pgh.pa.us
обсуждение исходный текст
Ответ на no cascade triggers?  (Chris Mair <chris@1006.org>)
Ответы R: [postgresql-it] no cascade triggers?  ("Manera, Villiam" <vmanera@manord.com>)
Список pgsql-hackers
Chris Mair <chris@1006.org> writes:
> On the italian list we're discussing a case were a user reportedly
> worked around this (i.e. got rid of unwanted cascading calls) by
> writing an on insert trigger procedure something on the lines of:

> ALTER TABLE tab DISABLE TRIGGER USER;
>   -- do more inserts into the same table
> ALTER TABLE tab ENABLE TRIGGER USER;

> While this reporetedly worked well in 8.2.1 it does not in 8.2.4
> resulting in an error:
>    ERROR: relation "distinta_base1" is being used by active queries
>    in this session Stato SQL: 55006

We could possibly re-allow that (see the comments in AlterTable())
but it seems like an ugly and inefficient technique that we shouldn't
be encouraging.  (The implications for system catalog bloat alone
seem enough reason to not recommend this.)  Isn't there a cleaner way
to design his application?  Maybe refactor the schema to avoid the
recursion in the first place?  Or add an "insert origin" column to the
table so that the trigger can easily detect trigger-inserted rows and
do nothing?
        regards, tom lane


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

Предыдущее
От: "A.M."
Дата:
Сообщение: Re: no cascade triggers?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: [PATCHES] New Zealand - TZ change