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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Clift <aa2(at)bigpond(dot)net(dot)au>
Cc: 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-22 03:23:32
Message-ID: 2422.993180212@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Justin Clift <aa2(at)bigpond(dot)net(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Mamin 2001-06-22 04:10:26 Re[2]: Postgres is too slow?
Previous Message Bruce Momjian 2001-06-22 03:13:44 Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer