Re: table with sort_key without gaps

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Janning Vygen <vygen(at)gmx(dot)de>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org
Subject: Re: table with sort_key without gaps
Date: 2004-12-13 10:32:50
Message-ID: 1102933971.6173.23.camel@sabrina.peacock.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-12-13 11:16:40 Re: index not used in joins
Previous Message Janning Vygen 2004-12-13 09:58:25 Re: table with sort_key without gaps