Re: What Is The Firing Order?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, cnliou(at)eurosport(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: What Is The Firing Order?
Date: 2001-09-07 18:49:59
Message-ID: 200109071849.f87Inxn02410@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Added to TODO:

* Allow user to control trigger firing order

> On Fri, 7 Sep 2001, Bruce Momjian wrote:
>
> > > > 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.
> > >
> > > Yes, the semantics of immediate and deferred triggers wouldn't change.
> > > I'm just suggesting that when the system has a choice of legal firing
> > > orders, it adopt an "alphabetical order" rule. AFAICS, all it would
> > > take to implement this is for RelationBuildTriggers to sort the list
> > > of triggers just after it's read them from pg_trigger and before it
> > > inserts them into the TriggerDesc structure (ie, about line 638 of
> > > trigger.c in current sources). The latter insertion is where they
> > > are divided into categories, so the sorting would end up only affecting
> > > the ordering within categories.
> > >
> > > The interesting question is not that, really, but whether an
> > > alphabetical-ordering rule will be useful and convenient. I don't
> > > recall exactly how the system chooses names for triggers that it creates
> > > --- if the user can't control those at all then this idea may not be
> > > helpful.
> >
> > Should we get a system where the user can control the firing, perhaps
> > using oid order?
>
> I don't think oid order would help, because what happens if you've say got
> a trigger and then want to add another before it? I'd guess the most
> general way would be to give triggers some kind of numeric ordering not
> associated with anything else, but then you need ways to set it on create
> trigger and probably an alter trigger way to change it. :( I'd guess that
> there'd be a default value if you didn't set it, and that triggers of the
> same value would run in indeterminate order like before.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Micah Yoder 2001-09-07 19:02:40 Re: Great Bridge ceases operations
Previous Message Bruce Momjian 2001-09-07 18:25:24 Re: [GENERAL] Re: Re: copy to/from stdout using libpgtcl