| From: | "gabi munteanu" <gmunteanu(at)hotmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | sequence problem |
| Date: | 2001-05-21 19:33:27 |
| Message-ID: | F242ekzabtneqdGSyMp00007bbe@hotmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
I have the following problem.
I have a table [friends] and it looks like this:
id serial
name varchar(25)
phone varchar(15)
After I created it tehre is also a sequence that generates me the ids
friens_id_seq
Let's say I have 5 records.
If I remove the 3th my ids will be 1,2,4,5 and my friends_id_seq=5.
if I remove the 5th my ids will be 1,2,4 and my friends_id_seq=5.
I want the following:
if I remove a record my ids should always be like this:
1,2,3,4... and not 1,2,4,5,9,...
I made a trigger that does my friends_id_seq = max(id) after delete.
Can anyone help me?
Thanx in advance
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2001-05-21 20:24:19 | Re: sequence problem |
| Previous Message | Adam Haberlach | 2001-05-21 16:06:07 | Re: problem while starting server ??? |