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

From Justin Clift
Subject Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer
Date
Msg-id 01062716334603.08550@justin
Whole thread Raw
In response to Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer  (Matt Beauregard <matt@designscape.com.au>)
Responses Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer  (Shaun Thomas <sthomas@townnews.com>)
List 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.

pgsql-general by date:

Previous
From: "Aldo Vadillo Batista"
Date:
Subject: About pg_dump
Next
From: Shaun Thomas
Date:
Subject: Re: Suggested improvement : Adjust SEQUENCES to accept an INCREMENT of functionname(parameters) instead of an integer