Skip site navigation (1) Skip section navigation (2)

Setting up a cyclic sequence generator without holes

From: Leon Starr <leon_starr(at)modelint(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Setting up a cyclic sequence generator without holes
Date: 2011-06-21 18:57:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I am trying to set up a sequence that assigns values within a specific range, say 1-99.   But, for my particular application, I need the ability to de-allocate a number that was previously assigned, say 27.  Then, when we hit 99, I want the sequence to start cycling through the holes (and pick 27 next, assuming there were no other de-allocations).  I don't want the sequencer to simply cycle back through numbers already in use.

Has anyone else done this or know any tricks?  Otherwise, it looks like I will just have to make my own sequencer.  Thanks.

- Leon Starr

pgsql-novice by date

Next:From: Leon MatchDate: 2011-06-21 20:11:13
Subject: Job does not wok - How to test it?
Previous:From: Mike ThomsenDate: 2011-06-21 12:45:07
Subject: Some basic SSL configuration questions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group