From: David Johnston <polobo@yahoo.com>
To: 'Adrian Klaver' <adrian.klaver@gmail.com>
To: pgsql-sql@postgresql.org
Cc: 'Carlos Mennens' <carlos.mennens@gmail.com>
Subject: Re: Unable To Modify Table
Date: Thu, 12 Jan 2012 12:02:35 -0500
Message-ID: <017101ccd14b$fbc0f120$f342d360$@yahoo.com> (raw)
In-Reply-To: <201201120854.42306.adrian.klaver@gmail.com>
References: <CAAQLLO70j_j-nz7sZmXbcKT7QRmuf6oQRsCT_N5=+8UC7NFp1A@mail.gmail.com>
<201201120854.42306.adrian.klaver@gmail.com>
-----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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: polobo@yahoo.com, adrian.klaver@gmail.com, carlos.mennens@gmail.com
Subject: Re: Unable To Modify Table
In-Reply-To: <017101ccd14b$fbc0f120$f342d360$@yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox