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

From: Justin Clift <aa2(at)bigpond(dot)net(dot)au>
To: Matt Beauregard <matt(at)designscape(dot)com(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-27 06:33:46
Message-ID: 01062716334603.08550@justin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Matt,

I'm looking for a way to change an existing sequence's "increment" value on
the fly (after it's being created).

Can't seem to find a function which does this either. Being able to change
the increment every now and again would provide useful in some scenario's.

i.e. select setseqinc('foo_idnum_seq', 4);
This would change the sequence foo_idnum_seq to now increment by 4 instead of
whatever it was previously.

Does anyone have any idea of how to achieve this without dropping the
sequence?

Regards and best wishes,

Justin Clift

On Saturday 23 June 2001 03:45, Matt Beauregard wrote:
> On Fri, Jun 22, 2001 at 12:43:32PM +1000, Justin Clift wrote:
> > 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.
> >
> > Would others also benefit from this alteration? If so, we might like to
> > ask for it to be added to Bruce's TODO list.
>
> We would like a way to increment sequences by a random amount, to add
> some spice to order number generation and such. However it's never
> made it up the priorities list high enough for us to work out how it
> might be done. As someone suggested, a trigger might take care of it.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-06-27 07:00:01 Re: Bug in createlang?
Previous Message Joshua Adam Ginsberg 2001-06-27 05:49:20 Complicated query... is there a simpler way?