Re: FK - automatic value change when parent changes

From: Galen Boyer <galen_boyer_at_yahoo.com>
Date: Sat, 27 Feb 2010 11:56:22 -0500
Message-ID: <u3a0mhb2h.fsf_at_www.yahoo.com>



eh <timo.talja.email_at_gmail.com> writes:

> Hi,
> we have a Fk pointing to a parent table/column - and now sadly enough
> that primary key value will change.
> What would be a smart way to implement this change to these child
> tables ?
>
> Disabling FK's and a lot of update clauses or .... ??

Alter the FK constraint to deferred. Then, update the parent key with a follow-on update to the child key and then commit. Since the constraint is deferred, it won't bark at you during the operation.

-- 
Galen Boyer

--- news://freenews.netfront.net/ - complaints: news_at_netfront.net ---
Received on Sat Feb 27 2010 - 10:56:22 CST

Original text of this message