From: gabi munteanu <gmunteanu@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: sequence problem
Date: Mon, 21 May 2001 19:33:27
Message-ID: <F242ekzabtneqdGSyMp00007bbe@hotmail.com> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: gmunteanu@hotmail.com
Subject: Re: sequence problem
In-Reply-To: <F242ekzabtneqdGSyMp00007bbe@hotmail.com>
References: <F242ekzabtneqdGSyMp00007bbe@hotmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox