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

Поиск
Список
Период
Сортировка
Искать
От
T.J. Ferraro
Тема
Re: BUG #2393: update fails with unique constraint violation
Дата
Msg-id
4440FB7D.2030301@phreaker.net
Ответ на
Список
Дерево обсуждения
BUG #2393: update fails with unique constraint violation "Laurence Dawson" <larry.dawson@vanderbilt.edu>
Re: BUG #2393: update fails with unique constraint violation "T.J. Ferraro" <tjtoocool@phreaker.net>
Re: BUG #2393: update fails with unique constraint violation Bruce Momjian <pgman@candle.pha.pa.us>
Re: BUG #2393: update fails with unique constraint violation Lar <larry.dawson@vanderbilt.edu>
Re: BUG #2393: update fails with unique constraint violation Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #2393: update fails with unique constraint violation "Harald Armin Massa" <haraldarminmassa@gmail.com>
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=>
>
В списке pgsql-bugs по дате отправления
От: Harald Armin Massa
Дата:
От: Bruce Momjian
Дата:
FAQ