BUG #9485: RFE - cycling sequence rollover to do modulo

From: Paul(dot)Murray(at)environment(dot)gov(dot)au
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #9485: RFE - cycling sequence rollover to do modulo
Date: 2014-03-08 03:54:56
Message-ID: 20140308035456.2671.26311@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 9485
Logged by: Paul Murray
Email address: Paul(dot)Murray(at)environment(dot)gov(dot)au
PostgreSQL version: 9.3.2
Operating system: OSX
Description:

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;

This allows me to create a sequence where the generated numbers are not
consecutive, but which will exhaust the number range I have assigned (by
making the increment relatively prime to the number of elements in the
range).

(PS: 616/1000 is, of course, the golden ratio <g>)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message richardozsvald 2014-03-09 07:57:51 BUG #9500: problem with password
Previous Message centella.2013 2014-03-07 22:37:05 BUG #9479: Perdida de información