X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9030D475F1C for ; Sat, 1 Feb 2003 09:16:17 -0500 (EST) Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (Postfix) with ESMTP id D0A8C475B8A for ; Sat, 1 Feb 2003 09:16:02 -0500 (EST) Received: by druid.net (Postfix, from userid 1000) id EEDB41B05; Sat, 1 Feb 2003 09:16:08 -0500 (EST) Content-Type: text/plain; charset="iso-8859-1" From: "D'Arcy J.M. Cain" To: Carmen Marincu , pgsql-sql@postgresql.org Subject: Re: vacuum and serial primary keys Date: Sat, 1 Feb 2003 09:16:08 -0500 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Message-Id: <200302010916.08465.darcy@druid.net> Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/7 X-Sequence-Number: 11405 On Saturday 01 February 2003 07:45, Carmen Marincu wrote: > I am using Postgresql 7.1.3 and I have deleted 3000 rows from a table > (with DELETE). > Than I used vacuum to actually delete the rows markes as deleted > by the DELETE command.. > The trouble is that the "counter" for the serial primary key (ID field) > wasn't reset. So now althought I have only 2 rows in my table they have > the ID 3001 and 3002. > > Is this normal ? If not could someone please explain me how could I reset > the "counter" to ignore the deleted rows ? It is very normal. The last thing you need is a database engine that chang= es=20 your primary key without an explicit command to do so. In fact, sometimes = I=20 think that the database should enforce the rule that primary keys are=20 immutable and not even allow it explicitely. Perhaps a configuration optio= n. --=20 D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.