pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRE: reinitialise serial counter
2+ messages / 2 participants
[nested] [flat]
* RE: reinitialise serial counter
@ 2000-11-07 16:55 Edmar Wiggers <edmar@brasmap.com>
parent: Indraneel Majumdar <indraneel@www.cdfd.org.in>
0 siblings, 0 replies; 2+ messages in thread
From: Edmar Wiggers @ 2000-11-07 16:55 UTC (permalink / raw)
To: Indraneel Majumdar <indraneel@www.cdfd.org.in>; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* reinitialise serial counter
@ 2000-11-07 21:30 Indraneel Majumdar <indraneel@www.cdfd.org.in>
0 siblings, 1 reply; 2+ messages in thread
From: Indraneel Majumdar @ 2000-11-07 21:30 UTC (permalink / raw)
To: pgsql-sql
Hi,
I have a table
create table test (id serial, name text);
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?
thanks,
Indraneel
/************************************************************************.
# Indraneel Majumdar ¡ E-mail: indraneel@123india.com #
# Bioinformatics Unit (EMBNET node), ¡ URL: http://scorpius.iwarp.com #
# Centre for DNA Fingerprinting and Diagnostics, #
# Hyderabad, India - 500076 #
`************************************************************************/
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-11-07 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-07 21:30 reinitialise serial counter Indraneel Majumdar <indraneel@www.cdfd.org.in>
2000-11-07 16:55 ` Edmar Wiggers <edmar@brasmap.com>
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