From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Paul.Murray@environment.gov.au
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9485: RFE - cycling sequence rollover to do modulo
Date: Sun, 9 Mar 2014 20:47:15 -0300
Message-ID: <20140309234715.GH4759@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <20140308035456.2671.26311@wrigleys.postgresql.org>
References: <20140308035456.2671.26311@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Paul.Murray@environment.gov.au wrote:
> When a sequence with a cycle does a rollover, it sets itself to its minimum
> value.
>
> I would like an option to create a sequence that resets to the minimum value
> plus the amount by which the next number exceeded the maximum. Perhaps like
> this:
>
> create sequence foo increment 616 min value 0 maxvalue 999 cycle modulo;
Would this be useful?
http://www.postgresql.org/message-id/CA+U5nMKh+pmbaGUd_x9ev-F5k+whT8HM7wXfkX9ouF=cPkAQEg@mail.gmail....
You'd have to create a new "sequence access method" that provided the
behavior you want.
I think it'd be interesting to have an implementation of the behavior
you want on top of the proposed patch.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alvherre@2ndquadrant.com, Paul.Murray@environment.gov.au
Subject: Re: BUG #9485: RFE - cycling sequence rollover to do modulo
In-Reply-To: <20140309234715.GH4759@eldon.alvh.no-ip.org>
References: <20140308035456.2671.26311@wrigleys.postgresql.org> <20140309234715.GH4759@eldon.alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox