How to reset sequences on pre-7.1
How to reset sequences on pre-7.1
От:
"Matteo Beccati" <m.beccati@crpsoftware.it>
Дата:
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
Re: How to reset sequences on pre-7.1
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Matteo Beccati" 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