| От | Luis Neves |
|---|---|
| Тема | Strange behaviour updating primary key column. |
| Дата | |
| Msg-id | 200406210729.07185.lneves@netcabo.pt обсуждение |
| Ответы |
Re: Strange behaviour updating primary key column.
|
| Список | pgsql-sql |
[Sorry if this is a double post.] Hello all, [Postgresql 7.4.2] CREATE TABLE "story" ( "id" int4 NOT NULL, "title" varchar (100) NOT NULL, "body" text NOT NULL, "entryDate" timestamptz NOT NULL, CONSTRAINT "story_pkey" PRIMARY KEY (id) ); In the above table why does the query: UPDATE "story" SET id = (id + 1500); fails with: "ERROR: duplicate key violates unique constraint 'story_pkey'" (I have 6000 records in the table with "id" spanning from 1 to 6000) I find this behaviour strange, SQL is a set based language, but PostgreSQL is acting like is changing the values in sequence. Can anyone with a better understanding of PostgreSQL explain to me why this happens? Are my expectations wrong? Best regards, Luis Neves
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера