Re: Controling Rule's Firing Order

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: cn <cnliou(at)eurosport(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Controling Rule's Firing Order
Date: 2002-08-24 01:25:52
Message-ID: Pine.LNX.4.44.0208232119300.4273-100000@cm-lcon1-46-187.cm.vtr.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2002-08-24 03:22:17 PostgreSQL 7.2.2: Security Release
Previous Message Greg Patnude 2002-08-24 01:15:28 Retrieving the new "nextval" for primary keys....