Re: Controling Rule's Firing Order

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <cnliou(at)eurosport(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Controling Rule's Firing Order
Date: 2002-08-26 03:41:40
Message-ID: 20020825203515.I55041-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 26 Aug 2002 cnliou(at)eurosport(dot)com wrote:

> Thank you! Alvaro and Stephan,
>
> > The name of a foreign key trigger is a constant
> > beginning followed by an oid.
>
> Now I think I have found that FK trigger names look
> like this:
>
> RI_ConstraintTrigger_<OID>
>
> > but you should be able to make triggers run
> > before/after the foreign key trigger by picking
> > names before/after the constant part of the
> > fk trigger name.
>
> Yes, this is the way for me to go. The last missing
> better-have feature is the firing order among FK
> triggers for master and detail tables:
>
> - When the primary key of master record is to be
> updated, the primary key of this master record is
> updated before those of its child records.

If you mean, upon an update of master record, the update occurs
before the referential action, this should already be true
since it's an after trigger.

> - When the master record is to be deleted, its detail
> records are first deleted.

Unless we've misread the spec (which is possible) the above
does not comply with the foreign key specification. There
are disagreements about when the referential action should
occur, but the earliest anyone's found justification for
is upon marking a row for deletion the detail rows are marked
for deletion (we currently actually do it after this point
because we don't have an agreement as to what some of the phrases
mean).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-26 05:06:48 Re: [GENERAL] PostgreSQL 7.2.2: Security Release
Previous Message Marc G. Fournier 2002-08-26 02:16:41 Re: [GENERAL] PostgreSQL 7.2.2: Security Release