pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to reset sequences on pre-7.1
2+ messages / 2 participants
[nested] [flat]

* How to reset sequences on pre-7.1
@ 2002-04-17 12:44  Matteo Beccati <m.beccati@crpsoftware.it>
  0 siblings, 1 reply; 2+ messages in thread

From: Matteo Beccati @ 2002-04-17 12:44 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I usually use a:

SELECT setval('seq_name', NULL);

to reset sequences, so the next time it's called it returns '1'. This
works in all Pg releases I've ever tested but 7.0.

On an hosted space that still has a 7.0 release candidate, this query
fails, telling me that I cannot use a 0 value.

Anybody knows how to reset sequences in this case?

Regards
--
Matteo Beccati
http://www.phpadsnew.com
http://phppgads.sourceforge.net




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to reset sequences on pre-7.1
@ 2002-04-17 15:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Matteo Beccati <m.beccati@crpsoftware.it>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-04-17 15:25 UTC (permalink / raw)
  To: Matteo Beccati <m.beccati@crpsoftware.it>; +Cc: pgsql-sql

"Matteo Beccati" <m.beccati@crpsoftware.it> writes:
> I usually use a:

> SELECT setval('seq_name', NULL);

> to reset sequences, so the next time it's called it returns '1'. This
> works in all Pg releases I've ever tested but 7.0.

On all recent releases, that is a complete no-op, because setval() is
a strict function.  Better check what you were actually doing.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-04-17 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-17 12:44 How to reset sequences on pre-7.1 Matteo Beccati <m.beccati@crpsoftware.it>
2002-04-17 15:25 ` Tom Lane <tgl@sss.pgh.pa.us>

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