Re: Controling Rule's Firing Order - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Controling Rule's Firing Order
Date
Msg-id Pine.LNX.4.44.0208232119300.4273-100000@cm-lcon1-46-187.cm.vtr.net
Whole thread Raw
In response to Re: Controling Rule's Firing Order  (cn <cnliou@eurosport.com>)
List pgsql-general
cn dijo:


> > Foreign key triggers will fire in alphabetical order along with other triggers.
> > This means they're firing based on a textual sort of the OIDs assigned to the
> > triggers, which will often but not always correspond to creation order.
>
> I don't fully understand the meaning of the term "firing in alphabetic
> order" you mentioned earlier and "they're firing based on a textual sort
> of the OIDs assigned to the triggers". OIDs are integers. Why terms
> "textual" and "alphabetic" are used?  Did you actually referring them to
> the _names_ of triggers, rules, and FK triggers, instead of their OIDs?

Foreign key constraints are implemented internally with triggers.  Those
triggers are named after the foreign key that they serve, and that name
contains the OID that is apparently the only means of distinguishing
from others FK triggers (on the same table?).  The firing order of
foreign key is thus the firing order of the trigger, which is by OID (by
the OID their name contains).

I unfortunatly just broke my copy of Postgres so cannot show you an
example, but try looking at the names of the triggers inside your
database (yes, system catalog poking is a very interesting exercise).

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Las cosas son buenas o malas segun las hace nuestra opinion" (Lisias)


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Controling Rule's Firing Order
Next
From: Steve Lane
Date:
Subject: Why is pgbench suddenly slow?