A Smart Sequence needed

From: Brian <signal(at)shreve(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: A Smart Sequence needed
Date: 1998-07-02 20:26:31
Message-ID: Pine.LNX.3.96.980702152316.20460C-100000@mercury.shreve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)shreve(dot)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 -----------------------------/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken McGlothlen 1998-07-02 21:04:27 Re: [GENERAL] A Smart Sequence needed
Previous Message SierraAdm 1998-07-02 20:24:03 data entry forms