From: Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>
To: pgsql-sql@postgresql.org
Subject: Re: safely exchanging primary keys?
Date: Mon, 24 May 2010 19:11:22 +0200
Message-ID: <20100524171122.GA20077@apartia.fr> (raw)
In-Reply-To: <20100524170030.GB19481@apartia.fr>
References: <20100524085101.GA21249@apartia.fr>
<m3d3wl1i1c.fsf@passepartout.tim-landscheidt.de>
<20100524170030.GB19481@apartia.fr>
On Mon, May 24, 2010 at 07:00:30PM +0200, Louis-David Mitterrand wrote:
> On Mon, May 24, 2010 at 02:38:39PM +0000, Tim Landscheidt 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.
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: vindex+lists-pgsql-sql@apartia.org
Subject: Re: safely exchanging primary keys?
In-Reply-To: <20100524171122.GA20077@apartia.fr>
* 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