From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Paul(dot)Murray(at)environment(dot)gov(dot)au |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #9485: RFE - cycling sequence rollover to do modulo |
Date: | 2014-03-09 23:47:15 |
Message-ID: | 20140309234715.GH4759@eldon.alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Paul(dot)Murray(at)environment(dot)gov(dot)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?
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
From | Date | Subject | |
---|---|---|---|
Next Message | Claudio Freire | 2014-03-10 05:34:40 | Re: [BUGS] BUG #9479: Perdida de información |
Previous Message | Vik Fearing | 2014-03-09 21:57:20 | Re: BUG #9505: If a function references an unqualified table, it only resolves it from search_path once per session |