Re: What Is The Firing Order?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: cnliou(at)eurosport(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: What Is The Firing Order?
Date: 2001-09-07 16:29:07
Message-ID: Pine.BSF.4.21.0109070926010.98992-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Fri, 7 Sep 2001, Tom Lane wrote:

> <cnliou(at)eurosport(dot)com> writes:
> > The document says: "Also, if more than one trigger is
> > defined for the same event on the same relation, the
> > order of trigger firing is unpredictable.
>
> Yup, and it means what it says.
>
> > 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.
>
> If we were to modify the code to make the firing order predictable,
> I'd want it to be user-controllable. A simple hack that comes to
> mind is to fire triggers in alphabetical order by name --- then you
> can easily arrange for custom triggers to fall either before or after
> system-generated ones. But perhaps someone else has a better idea.

I think that'd probably work, although I think that you probably
want to ensure that deferred constraint triggers run after normal
triggers and immediate constraints when you're running statements
in their own implicit transactions, since that would model the
behavior (check on commit) better.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-09-07 16:33:43 Re: query help
Previous Message meena nimmagadda 2001-09-07 16:01:06 need help