From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: safely exchanging primary keys?
Date: Tue, 25 May 2010 01:22:46 +0000
Message-ID: <m3r5l0zsex.fsf@passepartout.tim-landscheidt.de> (raw)
References: <20100524085101.GA21249@apartia.fr>
<m3d3wl1i1c.fsf@passepartout.tim-landscheidt.de>
<20100524170030.GB19481@apartia.fr>
<20100524171122.GA20077@apartia.fr>
Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> wrote:
>> > you use something simple like (untested):
>> >
>> > | UPDATE cabin_type
>> > | SET id_cabin_type =
>> > | CASE
>> > | WHEN id_cabin_type = id1 THEN
>> > | id2
>> > | ELSE
>> > | id1
>> > | END
>> > | WHERE id_cabin_type IN (id1, id2);
>> Nice, thanks.
> Ah, but this won't work as the UNIQUE PK constraint is in force.
Oh, yes, you're right, I didn't have that premise in mind.
Tim
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: tim@tim-landscheidt.de
Subject: Re: safely exchanging primary keys?
In-Reply-To: <m3r5l0zsex.fsf@passepartout.tim-landscheidt.de>
* 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