X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5300AD1B1C8 for ; Mon, 21 Jun 2004 03:29:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33778-02 for ; Mon, 21 Jun 2004 06:29:08 +0000 (GMT) Received: from smtp.netcabo.pt (smtp.netcabo.pt [212.113.174.9]) by svr1.postgresql.org (Postfix) with ESMTP id C6075D1B1BB for ; Mon, 21 Jun 2004 03:29:05 -0300 (ADT) Received: from [192.168.1.100] ([81.84.32.135]) by smtp.netcabo.pt with Microsoft SMTPSVC(5.0.2195.6713); Mon, 21 Jun 2004 07:29:05 +0100 From: Luis Neves To: pgsql-sql@postgresql.org Subject: Strange behaviour updating primary key column. Date: Mon, 21 Jun 2004 07:29:06 +0100 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200406210729.07185.lneves@netcabo.pt> X-OriginalArrivalTime: 21 Jun 2004 06:29:05.0794 (UTC) FILETIME=[0D2C7620:01C45759] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200406/186 X-Sequence-Number: 18131 [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 =3D (id + 1500); fails with: "ERROR:=A0=A0duplicate=A0key=A0violates=A0unique=A0constraint=A0'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=20 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