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 F41709FA226 for ; Tue, 9 May 2006 03:36:54 -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 05542-09 for ; Tue, 9 May 2006 03:36:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 604639F931D for ; Tue, 9 May 2006 03:36:49 -0300 (ADT) Received: from Citrus.usj.edu.lb (rectorat2.usj.edu.lb [193.227.187.140]) by svr4.postgresql.org (Postfix) with ESMTP id 0D26A5B2DFE for ; Tue, 9 May 2006 06:36:46 +0000 (GMT) Received: from pascolo ([192.168.100.239]) by Citrus.usj.edu.lb (8.13.1/8.13.1) with ESMTP id k496gTV8021264 for ; Tue, 9 May 2006 09:42:33 +0300 Message-Id: <200605090642.k496gTV8021264@Citrus.usj.edu.lb> Reply-To: From: "Pascal Tufenkji" To: Subject: FW: reset all sequences Date: Tue, 9 May 2006 09:38:24 +0300 Organization: USJ MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_003C_01C6734C.51CF80E0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcZv7Z1x8CxSzQt9R3aUNKGJkqabcAC89e1gABRGzXAAACQ4oA== X-USJ-MailScanner-Information: Please contact the ISP for more information X-USJ-MailScanner: Found to be clean X-USJ-MailScanner-From: ptufenkji@usj.edu.lb X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/76 X-Sequence-Number: 21608 This is a multi-part message in MIME format. ------=_NextPart_000_003C_01C6734C.51CF80E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi 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 ??!! Thx Pascal -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Sriram Dandapani Sent: Monday, May 08, 2006 11:54 PM To: Bruno Wolff III Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] reset all sequences Thanks..that really helped!! -----Original Message----- From: Bruno Wolff III [mailto:bruno@wolff.to] Sent: Thursday, May 04, 2006 7:44 PM To: Sriram Dandapani Cc: pgsql-admin@postgresql.org Subject: Re: reset all sequences On Thu, May 04, 2006 at 14:20:39 -0700, Sriram Dandapani wrote: > Hi > > > > I have a scenario where I need to reset all sequences(about 400). Is > there a system table that I can query to get a list of sequences > (Postgres 8.1.x) You can do something like: select * from pg_class where relkind = 'S'; The relname column will give you the sequence name. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly ------=_NextPart_000_003C_01C6734C.51CF80E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi

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 ??!!

 

Thx

Pascal

 

 

-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Sriram = Dandapani
Sent: Monday, May 08, 2006 11:54 PM
To: Bruno Wolff III
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] reset all sequences

 

Thanks..that really helped!!

 

-----Original Message-----

From: Bruno Wolff III [mailto:bruno@wolff.to]

Sent: Thursday, May 04, 2006 7:44 PM

To: Sriram Dandapani

Cc: pgsql-admin@postgresql.org=

Subject: Re: reset all sequences

 

On Thu, May 04, 2006 at 14:20:39 -0700,

  Sriram Dandapani <sdandapani@counterpane.com> = wrote:

> Hi

>

> 

>

> I have a scenario where I need to reset all sequences(about 400). = Is

> there a system table that I can query to get a list of = sequences

> (Postgres 8.1.x)

 

You can do something like:

select * from pg_class where relkind =3D 'S';

The relname column will give you the sequence = name.

 

---------------------------(end of broadcast)---------------------------

TIP 1: if posting/reading through Usenet, please send an = appropriate

       subscribe-nomail command to majordomo@postgresql.org so that = your

       message can get through to the mailing list = cleanly

------=_NextPart_000_003C_01C6734C.51CF80E0--