From: Stuart <smcg2297@frii.com>
To: pgsql-sql@postgresql.org
Subject: Re: data dependent sequences?
Date: Tue, 17 Jul 2007 07:34:26 -0600
Message-ID: <f7iggu$1nb$1@sea.gmane.org> (raw)
References: <AKEFJAHAPDBEDKIICNJKMEJPCDAA.smcg2297@frii.com>
<1184515497.5778.141.camel@localhost.localdomain>
"Ragnar" <gnari@hive.is> wrote in message news:1184515497.5778.141.camel@localhost.localdomain...
> On sun, 2007-07-15 at 09:28 -0600, Stuart McGraw wrote:
> > Advice requested :-) I have a table like:
> >
> > CREATE TABLE items (
> > id INT,
> > typ INT ...
> > PRIMAY KEY (seq,typ));
> >
> > I would like 'id' to be like a SERIAL except that I
> > want independent sequences for each value of 'typ'.
>
> what possible advantage could there be to that?
>
> if you need gapless series, then sequences (and serial)
> are not adequate anyways.
>
> just use one sequence.
I am not looking for gapless sequences. The reason I
want to do this is the "typ" column is actually an indicator
of the source of the rest of the infomation in the row.
The "rules" for assigning the id number vary depending
on the source -- in some cases they start at 1 and increment
by one, in other cases they start at, say, 1000000 and
increment by 10. There are a lot existing data using these
rules and I cannot change that. I can of course have the
application do the assignments, but in general eould prefer
to push this down into the database if posible.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: smcg2297@frii.com
Subject: Re: data dependent sequences?
In-Reply-To: <f7iggu$1nb$1@sea.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox