On Sun, Dec 4, 2011 at 7:14 PM, Alban Hertroys <haram...@gmail.com> wrote:
> On 4 Dec 2011, at 11:19, Phoenix Kiula wrote:
....

>
> INSERTs in the parent table don't need to check for any reference from the 
> child table, since they're new; there can't be a reference. UPDATEs and 
> DELETEs do though, whether you let them CASCADE or not. If you don't, then 
> the database raises a foreign key constraint violation. If you do, then it 
> needs to modify the relevant rows in the child table.
>
> Likewise, INSERTs and UPDATEs in the child table need to verify that - if 
> their reference key changed - they're still referencing a valid row.



Thanks Albert. Very useful.

I had ON DELETE...ALSO DELETE rules earlier and in some cases they let
some keys go by in associated tables. Hope foreign key constraint is
more reliable!

PK

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to