Re: safely exchanging primary keys? - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: safely exchanging primary keys?
Date
Msg-id 20100524171122.GA20077@apartia.fr
Whole thread Raw
In response to Re: safely exchanging primary keys?  (Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>)
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Louis-David Mitterrand
Date:
Subject: Re: safely exchanging primary keys?
Next
From: David Harel
Date:
Subject: User function that returns a set of rows.