Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Date: 2001-06-28 14:07:02
Message-ID: 002c01c0ffdb$9c1caea0$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Am doing some work with sequences at the moment, and I'm finding it would
be
> useful to have sequences which use an increment amount decided by a
function
> call, instead of just a straight integer amount (as we presently do).
>
> For my example, I'd use this to add random positive increments
(specifically
> to avoid easy predictability of the sequence), but it would be quite
flexible.
>
> i.e. CREATE SEQUENCE newseq INCREMENT trunc(random() * 10);

Couldn't you just call nextval 0-9 random number of times before your
INSERTs?

> Could do the same for the START, MINVALUE and MAXVALUE parameters also.
>
> Would others also benefit from this alteration? If so, we might like to
ask
> for it to be added to Bruce's TODO list.

I'm usually Mr. Features, but I don't see a whole lot of value in this one.
I've tried to come up with a scenario that this might be useful and they're
all contrived examples that could probably be best handled by creating my
own system rather than forcing the functionality into the existing
mechanism. Unless a special case were made for this type of SEQUENCE, I
imagine that this would drastically slow them down as a whole.

I'd much rather see int8 SEQUENCEs than a change in increment amounts.

Greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philip Molter 2001-06-28 14:44:20 Re: vacuum job taking very long time to complete
Previous Message Namrata 2001-06-28 13:30:41 Binary Data Storage?