Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Dimitri Fontaine Newsgroups: comp.databases.postgresql Subject: Re: How do I avoid nextval() colliding with existing entries on wrapping? Date: Fri, 07 Jun 2013 18:54:08 +0200 Organization: A noiseless patient Spider Lines: 13 Message-ID: References: <51b20cb4$0$14017$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="936dfd813b4ee0cccab5407fc4e70f96"; logging-data="25421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fwSGHO1rIJg8A8J3Gtjtt" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (darwin) Cancel-Lock: sha1:j9Y7PfRbs4uuTzvCDRFsbkoNgvU= sha1:u/R+IOgqF7TZCck14dn5YUS5rbY= Xref: csiph.com comp.databases.postgresql:458 Mateusz Viste writes: > I badly need the value of the id column to always be in the range 0..99999, > so I added a "MAXVALUE 99999 CYCLE" directive to the sequence. You're in an uncomfortable situation then, and I'm not sure a sequence is what you need at all. Have a read of and see what you think http://www.varlena.com/GeneralBits/130.php Regards, -- Dimitri Fontaine PostgreSQL DBA, Architecte