On Mon, 2006-09-25 at 00:19 +0200, Gevik Babakhani wrote: > On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: > > It's the behavior I expect - but the gaps aren't acceptable. > > > > Bob > > Then using the SERIAL or SEQUENCE won't do you any good. > > A possible solution for this would be to regenerate the entire column's > values every time a record gets deleted starting form 1. but then again > this would be very slow if you have a very large table > It doesn't have to be slow. It seems to me this is more of a presentation issue than a data issue. He can just have a serial column, when you select from that table order by the serial, and then assign the numbers on the client side. If the original poster really needs to do it in the database server I guess he could use a procedural language and create a table function (i.e. returns setof ...) . There's nothing relational about what he wants to do, and PostgreSQL has procedural languages to handle procedural tasks. Regards, Jeff Davis