Shouldn't ON UPDATE/DELETE triggers be BEFORE triggers?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Shouldn't ON UPDATE/DELETE triggers be BEFORE triggers?
Date: 2001-04-02 16:23:50
Message-ID: 8087.986228630@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While thinking over Jeremy Radlow's recent problem report in
pgsql-general, it occurs to me that it's probably wrong to implement
referential integrity actions like ON CASCADE DELETE in AFTER triggers.
Seems to me that this breaks the fundamental rule of referential
integrity: if B references A then there must always be a matching A
row for every B row. Therefore, if we delete a row from A we should
delete the matching B row(s) before, not after, we delete from A.
Otherwise the remainder of the transaction sees an illegal state of
the database.

Comments? How about ON UPDATE actions?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-04-02 16:34:26 Re: Re: Changing the default value of an inherited column
Previous Message Robert E. Bruccoleri 2001-04-02 16:15:19 Irix binaries of 7.1 RC1 are available