Re: Unable To Modify Table - Mailing list pgsql-sql

From David Johnston
Subject Re: Unable To Modify Table
Date
Msg-id 017101ccd14b$fbc0f120$f342d360$@yahoo.com
Whole thread Raw
In response to Re: Unable To Modify Table  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Unable To Modify Table  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-sql
-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Adrian Klaver
Sent: Thursday, January 12, 2012 11:55 AM
To: pgsql-sql@postgresql.org
Cc: Carlos Mennens
Subject: Re: [SQL] Unable To Modify Table
> 
> How does one accomplish my goal? Is this difficult to change or once 
> that foreign key is created, are you stuck with that particular 
> constraint?


You are pushing in the wrong direction. You need to make the change in the
table 'orders'. This assumes the FK in 'orders' has ON UPDATE CASCADE
enabled.

----------------------------------------

Adrian, you are not helping...if ON UPDATE CASCADE was enabled on "orders"
the error in question would never have appeared and the UPDATE would have
succeeded.  Carlos' goal is to change the value of a Primary Key that has
already been used in a FOREIGN KEY constraint and he needs to learn to use
the documentation to solve some of these basic questions instead of asking
the list.   His approach is correct, execute UPDATE against the "developers"
table.

Deferrable constraints and transactions work as well but are more
complicated to setup and execute compared to the more direct ON UPDATE
CASCADE modifier to the FOREIGN KEY.  But learning both methods is good.

David J.




pgsql-sql by date:

Previous
From: "David Johnston"
Date:
Subject: Re: Unable To Modify Table
Next
From: Adrian Klaver
Date:
Subject: Re: Unable To Modify Table