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

From Tom Lane
Subject Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Date
Msg-id 2422.993180212@sss.pgh.pa.us
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>)
List pgsql-general
Justin Clift <aa2@bigpond.net.au> writes:
> i.e. CREATE SEQUENCE newseq INCREMENT trunc(random() * 10);

Hmm.  Bear in mind that the function would have to be executed whilst
holding the lock on the sequence object.  There are severe limits on
how long you'd want it to run, and on what it might try to do.
Perhaps we should talk about concrete examples of what would be useful;
I doubt that "execute an arbitrary piece of code" is likely to pass.

> Could do the same for the START, MINVALUE and MAXVALUE parameters also.

What would it mean to change the START value after the sequence has
begun to run?  If I reduce the MAXVALUE to something less than the
current sequence value, what happens?  Ditto MINVALUE.  This concept
needs work.

            regards, tom lane

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Next
From: Paul Mamin
Date:
Subject: Re[2]: Postgres is too slow?