Re: Unable To Modify Table

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Adrian Klaver'" <adrian(dot)klaver(at)gmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Cc: "'Carlos Mennens'" <carlos(dot)mennens(at)gmail(dot)com>
Subject: Re: Unable To Modify Table
Date: 2012-01-12 17:02:35
Message-ID: 017101ccd14b$fbc0f120$f342d360$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]
On Behalf Of Adrian Klaver
Sent: Thursday, January 12, 2012 11:55 AM
To: pgsql-sql(at)postgresql(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2012-01-12 17:10:02 Re: Unable To Modify Table
Previous Message David Johnston 2012-01-12 16:56:25 Re: Unable To Modify Table