Re: table with sort_key without gaps - Mailing list pgsql-general

From Tino Wildenhain
Subject Re: table with sort_key without gaps
Date
Msg-id 1102933971.6173.23.camel@sabrina.peacock.de
Whole thread Raw
In response to Re: table with sort_key without gaps  (Janning Vygen <vygen@gmx.de>)
List pgsql-general
Hi,

On Mon, 2004-12-13 at 10:58 +0100, Janning Vygen wrote:
> Am Samstag, 11. Dezember 2004 20:06 schrieb Bruno Wolff III:
> > On Thu, Dec 09, 2004 at 18:32:19 +0100,
> >
> >   Janning Vygen <vygen@gmx.de> wrote:
> > > "id" should be positive
> > > "id" should not have gaps within the same account
> > > "id" should start counting by 1 for each account
> > >
> > > i cant use sequences because they are producing gaps and doesn't start
> > > counting by 1 for each account and i dont want to use postgresql array
> > > type for various reasons.
> ...

> ok, it should work with sequences, too. I will try it. but isn't there a ready
> to use model which explains and avoids problems like the one with the update
> statement above?

Well, to get an idea on what you want to do here, maybe you use a sheet
of paper, a red and a blue pen (to simulate two concurrent requests)
and do step by step your inserts but do each step for every color:

1 blue
2 red
3 blue
4 red

and so on.
See to where it leads if you have to maintain the gaplessness.

Sometimes you can design the application differently to get what you
want at the end. Maybe you can expand a bit on your requirements
and what the reason behind these is?

Regards
Tino


pgsql-general by date:

Previous
From: Janning Vygen
Date:
Subject: Re: table with sort_key without gaps
Next
From: Richard Huxton
Date:
Subject: Re: index not used in joins