pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul.Murray@environment.gov.au
To: pgsql-bugs@postgresql.org
Subject: BUG #9485: RFE - cycling sequence rollover to do modulo
Date: Sat, 08 Mar 2014 03:54:56 +0000
Message-ID: <20140308035456.2671.26311@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      9485
Logged by:          Paul Murray
Email address:      Paul.Murray@environment.gov.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>)



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <20140308035456.2671.26311@wrigleys.postgresql.org>
Permalink:  ../20140308035456.2671.26311@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140308035456.2671.26311@wrigleys.postgresql.org

 · 

reply

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: Paul.Murray@environment.gov.au
  Subject: Re: BUG #9485: RFE - cycling sequence rollover to do modulo
  In-Reply-To: <20140308035456.2671.26311@wrigleys.postgresql.org>
  References: <20140308035456.2671.26311@wrigleys.postgresql.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