Re: Multiple triggers/rules

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Multiple triggers/rules
Дата
Msg-id 12962.982797849@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Multiple triggers/rules  (brichard@cafod.org.uk (Bruce Richardson))
Список pgsql-general
brichard@cafod.org.uk (Bruce Richardson) writes:
> OK, great.  Now - if a table has both a before-update trigger and an
> DO (as opposed to DO INSTEAD) update rule and the trigger cancels the
> update, is the update rule (or rules) cancelled?

No.  The trigger can only cancel the update of the specific tuple it's
being invoked for --- the query as a whole runs normally.  Indeed,
considering that ON UPDATE rules run before the original query, it'd
be difficult for a trigger on the original table to affect them.

You may have a conceptual problem here.  An ON UPDATE/DELETE rule
specifies an additional or substitute query to be run separately from
the initial UPDATE/DELETE query, but on the same tuple set (as achieved
by adding the initial query's WHERE clause to the rule's WHERE).  It's
not something you can turn on or off per affected tuple.  A trigger,
on the other hand, is fired separately for each tuple that a query is
about to (or just did) affect.  Triggers are a much lower-level
mechanism than rules.

            regards, tom lane

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

Предыдущее
От: Feite Brekeveld
Дата:
Сообщение: PHP 3.0.16 and pg_cmdtuples
Следующее
От: "Diehl, Jeffrey"
Дата:
Сообщение: RE: [SQL] handling of database size exceeding physical disk space