Skip site navigation (1) Skip section navigation (2)

Re: BUG #2393: update fails with unique constraint violation

From: "T(dot)J(dot) Ferraro" <tjtoocool(at)phreaker(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2393: update fails with unique constraint violation
Date: 2006-04-15 13:56:13
Message-ID: 4440FB7D.2030301@phreaker.net (view raw or flat)
Thread:
Lists: pgsql-bugs
Isn't that expected? Your query will try to update row 3 first and set 
the primary key to 5, which in fact would violate the primary key 
constraint on that table.

Laurence Dawson wrote:
> And then try an update:
> lstore=> select * from test.test;
>  a
> ----
>   1
>   2
>   3
>   4
>   5
>   6
>   7
>   8
>   9
>  10
> (10 rows)
>
> lstore=> update test.test set a = a + 2 where a >= 3;
> ERROR:  duplicate key violates unique constraint "pk"
> lstore=>
>   


In response to

Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2006-04-15 14:04:56
Subject: Re: BUG #2393: update fails with unique constraint violation
Previous:From: Harald Armin MassaDate: 2006-04-15 13:54:01
Subject: Re: BUG #2393: update fails with unique constraint violation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group