From: | "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | RE: Shouldn't ON UPDATE/DELETE triggers be BEFORE trigg ers? |
Date: | 2001-04-02 17:05:30 |
Message-ID: | 8F4C99C66D04D4118F580090272A7A234D3364@sectorbase1.sectorbase.com |
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?
No - AFTER is right place where to do action: don't forget
about DEFERRED RI constraints for which we have to perform
check/action sometime later *after* we changed PK/FK rows.
Vadim
From | Date | Subject | |
---|---|---|---|
Next Message | Lamar Owen | 2001-04-02 17:20:43 | Re: Re: Indexes vs indices |
Previous Message | Bruce Momjian | 2001-04-02 16:58:52 | Re: Indexes vs indices |