avoiding endless loop in an UPDATE trigger

Поиск
Список
Период
Сортировка
От Norman J. Clarke
Тема avoiding endless loop in an UPDATE trigger
Дата
Msg-id Pine.LNX.4.21.0102261151060.28752-100000@curly.combimatrix.com
обсуждение исходный текст
Ответы Re: avoiding endless loop in an UPDATE trigger  ("Dominic J. Eidson" <sauron@the-infinite.org>)
Re: avoiding endless loop in an UPDATE trigger  (Louis-David Mitterrand <vindex@apartia.ch>)
Список pgsql-general
Hello,

I am attempting to write a trigger function or rule in pl/pgsql that runs
on UPDATE to a table named "nodes". From inside this trigger, I would like
to UPDATE the same "nodes" table. How can I do this without entering into
an endless loop?

At the moment, I have a trigger which does the following:

<snip>
UPDATE pg_class SET reltriggers = 0 WHERE relname = ''nodes'';
</snip>

At the end of the function, I again update pg_class.reltriggers to its
previous value, thus reenabling triggers.

The problem with this is that it disables all of my FOREIGN KEY
constraints during function execution, which is undesirable.

I am sure there must be a more elegant way to accomplish this, but I have
not found it. Could anyone offer some advice?

Thanks!

Regards,

Norm

--------------------------------------
Norman Clarke
Combimatrix Corp Software Development
Harbour Pointe Tech Center
6500 Harbour Heights Pkwy, Suite 301
Mukilteo, WA 98275

tel: 425.493.2240
fax: 425.493.2010
--------------------------------------



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

Предыдущее
От: Aristide Aragon
Дата:
Сообщение: Re: Help with pq++
Следующее
От: "Dominic J. Eidson"
Дата:
Сообщение: Re: avoiding endless loop in an UPDATE trigger