Trigger disable for table

Поиск
Список
Период
Сортировка
От Frank Durstewitz
Тема Trigger disable for table
Дата
Msg-id 48E4A1CC.6060209@emporis.com
обсуждение исходный текст
Ответы Re: Trigger disable for table  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Trigger disable for table  (Terry Lee Tucker <terry@chosen-ones.org>)
Список pgsql-general
Hi list.

A fairly complex problem:

- Table A has a before insert/update trigger, which look up table B and
use field C from table B.
- Table B has a after insert/update trigger, which update table A with
field C.

The update on table B triggers the trigger from table A, so the same
thing is done twice.
Can one avoid to fire the trigger on table A, when updates are made to
table B, because i know all fields already and can build the update sql
for table A, so no need to call the trigger on table A?

My idea is to have it like
...
IF NEW.published = TRUE THEN
    ALTER TABLE a DISABLE TRIGGER mytrigger USER;
    (do update here)
    ALTER TABLE a ENABLE TRIGGER mytrigger USER;
...

Will a construct like this disable the trigger only inside the this
function or is the trigger disabled outside (visiblility?) the function,
too, which is unacceptable.

(Hmm, sounds very confused, and so i am...)

A helping hand on this topic is well accepted :-)

Thanks, Frank

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

Предыдущее
От: Reg Me Please
Дата:
Сообщение: Re: Transactions within a function body
Следующее
От: Markus Wanner
Дата:
Сообщение: Postgres major version support policy on Debian