Re: What Is The Firing Order?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: What Is The Firing Order?
Дата
Msg-id Pine.LNX.4.30.0109072104300.680-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: What Is The Firing Order?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: What Is The Firing Order?
Список pgsql-general
Tom Lane writes:

> > My another question is: When both UPDATE trigger (and
> > its trigger function) and UPDATE CASCADE constraint
> > are both defined, is the custom UPDATE trigger or the
> > UPDATE CASCADE constraint fired first?
>
> > I wish the constraint will be fired first.
>
> That seems fairly arbitrary; someone else might wish the opposite,
> depending on the details of what they want to do.

We should probably check first whether the SQL standard has anything to
say about the relative ordering of foreign key cascade actions versus
triggers.  (I would tend to think that triggers come after FK actions.
However, things might get tricky when cascade actions fire triggers of
their own.)

The order of execution of "pure" triggers meanwhile is defined thus:

         The order of execution of a set of triggers is ascending by value
         of their timestamp of creation in their descriptors, such that the
         oldest trigger executes first. If one or more triggers have the
         same timestamp value, then their relative order of execution is
         implementation-defined.  [4.35]

This is probably what happens in practice anyway, so it might make sense
to follow this rule.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: What Is The Firing Order?
Следующее
От: Andrew Sullivan
Дата:
Сообщение: moving char() to varchar()