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

Re: Multi row sequence?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ciprian Popovici <ciprian(at)zuavra(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multi row sequence?
Date: 2004-12-19 15:40:40
Message-ID: 20041219154040.GB2263@wolff.to (view raw or flat)
Thread:
Lists: pgsql-general
On Sun, Dec 19, 2004 at 15:02:27 +0200,
  Ciprian Popovici <ciprian(at)zuavra(dot)net> wrote:
> On Sat, 18 Dec 2004 11:07:37 -0600 Bruno Wolff III <bruno(at)wolff(dot)to> wrote:
> > On Fri, Dec 17, 2004 at 11:10:12 -0000,
> >   Filip Wuytack <fwuytack(at)fgscapital(dot)com> wrote:
> > > Is it possible to have a sequence (as a multirow prim key), where
> > > sequence (id) only increase per group of data (grp).
> > 
> > Why do you want to do this? It would be a lot simpler to generate unique
> > values over the table and that will work just fine if all you need
> > is uniqueness.
> 
> Here's a case where what he said would come in handy: arranging a
> particular display order within the individual groups. You have the unique
> key for the entire table, but you need something like a serial restricted
> to just a group of rows.

You wouldn't want to use a serial type for that. Inserts would become a big
pain. You can use numeric or text so that it is easy to do inserts.

In response to

pgsql-general by date

Next:From: Michael FuhrDate: 2004-12-19 19:23:09
Subject: Re: A "cascade on delete" constraints deletes AFTER the source is gone??
Previous:From: Bruno Wolff IIIDate: 2004-12-19 15:21:44
Subject: Re: Scheduler in Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group