Re: Odd(?) RI-trigger behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Odd(?) RI-trigger behavior
Date: 2002-04-19 03:30:26
Message-ID: 20868.1019187026@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> Didn't someone (Peter?) say that the mandated firing order was based on
> creation order/time in SQL99?

It does say that:

The order of execution of a set of triggers is ascending by value
of their timestamp of creation in their descriptors, such that the
oldest trigger executes first. If one or more triggers have the
same timestamp value, then their relative order of execution is
implementation-defined.

However, this strikes me as fairly brain-dead; it's unnecessarily hard
to control the order of trigger execution. You have to drop and
recreate triggers if you want to insert a new one at a desired position.
Worse, if you create several triggers in the same transaction, they'll
have the same timestamp --- leaving you right back in the
implementation-defined case. But if you want to make your rearrangement
atomically with respect to other transactions, you have little choice
but to drop/recreate in one xact. Looks like a catch-22 to me.

ISTM we had discussed this before and concluded that name order was
a more reasonable definition. Nobody had got round to doing anything
about it though. (Indeed my current hack was not intended to provide
a predictable firing order, it just fell out that way...)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2002-04-19 03:43:54 Re: Odd(?) RI-trigger behavior
Previous Message Peter Eisentraut 2002-04-19 03:28:48 Re: syslog support by default

Browse pgsql-patches by date

  From Date Subject
Next Message Stephan Szabo 2002-04-19 03:43:54 Re: Odd(?) RI-trigger behavior
Previous Message Stephan Szabo 2002-04-19 03:09:55 Re: Odd(?) RI-trigger behavior