pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedReset sequence number
4+ messages / 4 participants
[nested] [flat]
* Reset sequence number
@ 2002-02-23 11:37 Marc <syn_uw@nospan_hotmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: Marc @ 2002-02-23 11:37 UTC (permalink / raw)
To: pgsql-admin
Hello,
How can I reset a sequence number back to 0 ?
Regards
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Reset sequence number
@ 2002-02-23 17:07 Lee Harr <missive@frontiernet.net>
parent: Marc <syn_uw@nospan_hotmail.com>
1 sibling, 1 reply; 4+ messages in thread
From: missive@frontiernet.net @ 2002-02-23 17:07 UTC (permalink / raw)
To: pgsql-admin
> How can I reset a sequence number back to 0 ?
>
SELECT setval('sequence_name', 0);
In order for this to work, the sequence must have been created with
a MINVALUE of 0 (the default MINVALUE is 1)
CREATE SEQUENCE sequence_name MINVALUE 0;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Reset sequence number
@ 2002-02-25 15:28 Bruno Wolff III <bruno@wolff.to>
parent: Lee Harr <missive@frontiernet.net>
0 siblings, 0 replies; 4+ messages in thread
From: Bruno Wolff III @ 2002-02-25 15:28 UTC (permalink / raw)
To: missive@hotmail.com; +Cc: pgsql-admin
On Sat, Feb 23, 2002 at 05:07:34PM +0000,
Lee Harr <missive@frontiernet.net> wrote:
> > How can I reset a sequence number back to 0 ?
> >
>
> SELECT setval('sequence_name', 0);
>
>
> In order for this to work, the sequence must have been created with
> a MINVALUE of 0 (the default MINVALUE is 1)
>
> CREATE SEQUENCE sequence_name MINVALUE 0;
Note, that if you do it this way, 1 will be the next sequent number returned
by nextval. If you want 0 to be returned next use setval('seq_name', 0, false).
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Reset sequence number
@ 2002-02-26 00:48 Lonh SENG <slonh@camgsm.com.kh>
parent: Marc <syn_uw@nospan_hotmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: Lonh SENG @ 2002-02-26 00:48 UTC (permalink / raw)
To: Marc <syn_uw@nospan_hotmail.com>; pgsql-admin
I use truncate table $table_name.
This will delete all data from that table and reset the sequense number.
----- Original Message -----
From: "Marc" <syn_uw@nospan_hotmail.com>
To: <pgsql-admin@postgresql.org>
Sent: Saturday, February 23, 2002 6:37 PM
Subject: [ADMIN] Reset sequence number
> Hello,
>
> How can I reset a sequence number back to 0 ?
>
> Regards
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-02-26 00:48 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-23 11:37 Reset sequence number Marc <syn_uw@nospan_hotmail.com>
2002-02-23 17:07 ` Lee Harr <missive@frontiernet.net>
2002-02-25 15:28 ` Bruno Wolff III <bruno@wolff.to>
2002-02-26 00:48 ` Lonh SENG <slonh@camgsm.com.kh>
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