RE: reinitialise serial counter

From: "Edmar Wiggers" <edmar(at)brasmap(dot)com>
To: "Indraneel Majumdar" <indraneel(at)www(dot)cdfd(dot)org(dot)in>, <pgsql-sql(at)postgresql(dot)org>
Subject: RE: reinitialise serial counter
Date: 2000-11-07 16:55:20
Message-ID: NEBBIAKDCDHFGJMLHCKIKEAACBAA.edmar@brasmap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> after inserting values and doing delete from test if I try to insert
> values again, the id starts from where it left off previously. How can I
> get the serial counter to restart from 1 ? is it anything to do with
> setval(). How to use the setval?

The serial value is implemented using a sequence object (see the docs). Once
a sequence returns a number it will never return it again (that's what
sequences are for!).

A serial field is not a good approach if you always want to start numbering
at 1.

Yours sincerely,

Edmar Wiggers
BRASMAP Information Systems
+55 48 9960 2752

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kate Collins 2000-11-07 17:18:55 Trouble Converting Dates
Previous Message Najm Hashmi 2000-11-07 15:53:37 Re: Re: Returning Recordsets from Stored-procs