Re: Cascading Changes - Mailing list pgsql-novice

From Joel Burton
Subject Re: Cascading Changes
Date
Msg-id JGEPJNMCKODMDHGOBKDNIEECCOAA.joel@joelburton.com
Whole thread Raw
In response to Cascading Changes  (Tom Ansley <tansley@law.du.edu>)
List pgsql-novice
What do you mean by "linked"? Do you mean that there is referential
integrity (foriegn key constraint) between the two? Or do you just mean that
they contain the same value, and this is a understood-by-you logical link?

If there is referential integrity, you should define the RI as "ON UPDATE
CASCADE", and changes made to the parent table key will roll out to the
child table.

If there is no RI, then just write two UPDATE statements.

If there is RI, but you didn't define ON UPDATE CASCADE (the default is to
forbid changing a parent or pkey is a child refers to it), then you'll need
to DROP the constraint TRIGGER, run two separate UPDATE statements, and
re-create the trigger.

(Or, more sneaky but faster, you can hack a bit in the system tables to turn
the constraint to ON UPDATE CASCADE. See my article at
techdocs.postgresql.org on "Hacking the RI Tables" for more information.)

Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Tom Ansley
> Sent: Tuesday, May 14, 2002 12:09 PM
> To: pgsql-novice@postgresql.org
> Subject: [NOVICE] Cascading Changes
>
>
> Hi,
>
> I have tried looking for cascading changes through multiple
> tables and don't
> seem to be able to find anything in the documentation.  Can
> anybody point me
> in the right direction.
>
> I just want to change the primary key in two linked records in
> two different
> tables from 'Fox' to 'FOX'
>
> Thanks
>
> Tom
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


pgsql-novice by date:

Previous
From: Tom Ansley
Date:
Subject: Cascading Changes
Next
From: Oliver Elphick
Date:
Subject: Re: Cascading Changes