A Smart Sequence needed - Mailing list pgsql-general

From Brian
Subject A Smart Sequence needed
Date
Msg-id Pine.LNX.3.96.980702152316.20460C-100000@mercury.shreve.net
Whole thread Raw
List pgsql-general
I know how to make a simple sequence, that will start at a value, and
increment that value.  What I am needing is something like this however:

say you have a relationship such as:

1    john
2    amy
3    jim
4    sue
5    mike

ok, and a seqence will cause the next one to be 6 right? And this is fine
for me, except I want if "jim" for example is gone, he creates a hole
there, a gap.  I want the gap to be filled in.  So instead of a "next
available" sequence, I want a "first availabe":

1    john
2     amy
4    sue
5     mike

I want a sequence thats smart enough to pick 3 as the next "slot", since
that is the first available.  If this capibility is not possible, please
let me know.  It's probably quite simple, but I don't know the answer
after reading create_sequence, so I am asking it here.  Thank you for the
help.

Brian


/-------------------------- signal@shreve.net -----------------------------\
| Brian Feeny                | USR TC Hubs | ShreveNet Inc. (318)222-2638  |
| Network Administrator      | Perl, Linux | Web hosting, online stores,   |
| ShreveNet Inc.             |  USR Pilot  | Dial-Up 14.4-56k, ISDN & LANs |
| 89 CRX DX w/MPFI, lots of  |-=*:Quake:*=-| http://www.shreve.net/        |
| mods/Homepage coming soon  |LordSignal/SN| Quake server: 208.206.76.47   |
\-------------------------- 318-222-2638 x109 -----------------------------/



pgsql-general by date:

Previous
From: James Olin Oden
Date:
Subject: Re: [GENERAL] JDBC SQL command problems
Next
From: Ken McGlothlen
Date:
Subject: Re: [GENERAL] A Smart Sequence needed