Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Mon, 25 Sep 2006 10:37:06 -0700
  • Message-id: <1159205826(dot)7578(dot)91(dot)camel(at)dogma(dot)v10(dot)wvs>

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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group