Re: set-level update fails with unique constraint violation

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: set-level update fails with unique constraint violation
Date: 2009-12-31 15:52:31
Message-ID: 9837222c0912310752w1a5c22ddr38a3023dcc65b064@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/12/31 neuhauser+pgsql-general#postgresql.org
<neuhauser+pgsql-general#postgresql(dot)org(at)sigpipe(dot)cz>:
> Hello,
>
> this fails with "duplicate key value":
>
>    CREATE TABLE x (
>      i INT NOT NULL UNIQUE
>    );
>    INSERT INTO x (i) VALUES (1), (2), (3);
>    UPDATE x SET i = i + 1;
>
> are there any plans to make this work?

Sure. 8.5 (current alpha release included) will let you do
i INT NOT NULL UNIQUE DEFERRABLE

which will make that work.

(you might want to consider using an actual email address if you want
to get responses to your questions in the future)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2009-12-31 16:04:58 Re: set-level update fails with unique constraint violation
Previous Message Dmitry Koterov 2009-12-31 12:46:26 Re: Visual DATA editor for PostgreSQL?