Order of update triggers

Поиск
Список
Период
Сортировка
От Rob Richardson
Тема Order of update triggers
Дата
Msg-id 67D108EDFAD3C148A593E6ED7DCB4BBDFA351C@RADCONWIN2K8PDC.radcon.local
обсуждение исходный текст
Ответы Re: Order of update triggers  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
Список pgsql-novice

Greetings!

 

I have a table with several triggers.  One AFTER UPDATE trigger deletes a record if a field named “result” contains -55.  A second AFTER UPDATE trigger writes data from the table into a second table that stores a history of the first table, since the first table’s records are deleted after they are used.  The customer has asked that the first trigger be changed so that an update of the results field to -55 results in a new record being added to the history table, and also the record from the main table gets deleted.

 

Does the order in which those triggers fire matter?  Does PostgreSQL guarantee that both triggers will operate on the original data?  A quick test on a copy of the production database showed that the history table got the data from the main table after I set the result to -55, and then the record was deleted from the main table.  This could be because PostgreSQL has the guarantee I want, or just because the history trigger fired before the delete trigger.  Do I need to change anything?

 

RobR

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

Предыдущее
От: Brent Dombrowski
Дата:
Сообщение: Re: Total Newbie: Trouble installing postgresSQL on OS X Snow Leopard
Следующее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Order of update triggers