Received: from hotmail.com (f242.law14.hotmail.com [64.4.21.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4LJXUA31260 for ; Mon, 21 May 2001 15:33:30 -0400 (EDT) (envelope-from gmunteanu@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 21 May 2001 12:33:28 -0700 Received: from 194.105.18.224 by lw14fd.law14.hotmail.msn.com with HTTP; Mon, 21 May 2001 19:33:27 GMT X-Originating-IP: [194.105.18.224] From: "gabi munteanu" To: pgsql-sql@postgresql.org Subject: sequence problem Date: Mon, 21 May 2001 19:33:27 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 21 May 2001 19:33:28.0168 (UTC) FILETIME=[E8FC9680:01C0E22C] X-Archive-Number: 200105/228 X-Sequence-Number: 3045 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.