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

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Дата
Msg-id 002c01c0ffdb$9c1caea0$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer  (Justin Clift <aa2@bigpond.net.au>)
Ответы Re: Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Список 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 по дате отправления:

Предыдущее
От: Namrata
Дата:
Сообщение: Binary Data Storage?
Следующее
От: Alex Pilosov
Дата:
Сообщение: Re: Re: Red Hat to support PostgreSQL