Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer - Mailing list pgsql-general

From Gregory Wood
Subject Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Date
Msg-id 002c01c0ffdb$9c1caea0$7889ffcc@comstock.com
Whole thread Raw
In response to Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer  (Justin Clift <aa2@bigpond.net.au>)
Responses Re: Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer  (Jan Wieck <JanWieck@Yahoo.com>)
List 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


pgsql-general by date:

Previous
From: Namrata
Date:
Subject: Binary Data Storage?
Next
From: Alex Pilosov
Date:
Subject: Re: Re: Red Hat to support PostgreSQL