Re: serial column

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
Cc: Bob Pawley <rjpawley(at)shaw(dot)ca>, Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: serial column
Date: 2006-09-25 17:37:06
Message-ID: 1159205826.7578.91.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2006-09-25 17:39:19 Re: Replication and PITR
Previous Message Tom Lane 2006-09-25 17:07:17 Re: Increase default effective_cache_size?