X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E8DA39FA226 for ; Tue, 9 May 2006 03:42:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 11715-06 for ; Tue, 9 May 2006 03:42:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id B54A79F931D for ; Tue, 9 May 2006 03:42:40 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 6FC8835017; Mon, 8 May 2006 23:42:38 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 6CC5A34D58; Mon, 8 May 2006 23:42:38 -0700 (PDT) Date: Mon, 8 May 2006 23:42:38 -0700 (PDT) From: Stephan Szabo To: Pascal Tufenkji Cc: pgsql-admin@postgresql.org Subject: Re: FW: reset all sequences In-Reply-To: <200605090642.k496gTV8021264@Citrus.usj.edu.lb> Message-ID: <20060508234048.E49285@megazone.bigpanda.com> References: <200605090642.k496gTV8021264@Citrus.usj.edu.lb> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/77 X-Sequence-Number: 21609 On Tue, 9 May 2006, Pascal Tufenkji wrote: > How can I reset the sequence to "1" > > If I use the following statement > > Select setval('mytable_id_seq',1); > > I put the last value as 1 > > So when I insert a new row the value will be "2" and not "1" as it should be > > I cannot put Select setval('mytable_id_seq',0); > > What should I do ??!! You should be able to do this with the three argument form of setval as setval('mytable_id_seq',1,false).