Re: What Is The Firing Order?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
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:12:21
Message-ID: Pine.BSF.4.21.0109071100350.99448-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Fri, 7 Sep 2001, Bruce Momjian wrote:

> > > 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.
>
> Yes, the problem with alphabetical order is that mere creation of a
> trigger would change the firing order. I was thinking oid order so
> there is some stability to the system for people who don't care about
> the order, and a way to control it for people who need to (create
> triggers in desired order).

The alphabetical ordering would change the order, but only with respect to
the new constraint and existing ones not between the existing ones. The
advantage here is that making a trigger fire before an existing one is
easy, since you can name before it.

The oid ordering has the property that the triggers would by default run
in creation order. Creating a new trigger would always put it at the end
unless you've wrapped oids which is nicer than having to worry about
interactions between the new trigger and existing ones based on where it
is (although you have to do that now), however putting a trigger before
an existing one means dropping and recreating one or more of your existing
triggers... all of the ones from where you want to put it in the order to
the last one.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-09-07 18:13:59 Re: What Is The Firing Order?
Previous Message Roderick A. Anderson 2001-09-07 18:06:59 Re: Idea: jobs.postgresql.org