From: Edmar Wiggers <edmar@brasmap.com>
To: Indraneel Majumdar <indraneel@www.cdfd.org.in>
To: pgsql-sql@postgresql.org
Subject: RE: reinitialise serial counter
Date: Tue, 7 Nov 2000 14:55:20 -0200
Message-ID: <NEBBIAKDCDHFGJMLHCKIKEAACBAA.edmar@brasmap.com> (raw)
In-Reply-To: <Pine.SGI.3.96.1001107132740.1055197A-100000@www.cdfd.org.in>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: edmar@brasmap.com, indraneel@www.cdfd.org.in
Subject: Re: reinitialise serial counter
In-Reply-To: <NEBBIAKDCDHFGJMLHCKIKEAACBAA.edmar@brasmap.com>
References: <Pine.SGI.3.96.1001107132740.1055197A-100000@www.cdfd.org.in> <NEBBIAKDCDHFGJMLHCKIKEAACBAA.edmar@brasmap.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox