Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WMSFh-00081e-68 for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Mar 2014 01:10:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WMSFg-0002Mb-3i for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Mar 2014 01:10:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WM8MA-0004ih-Jo for pgsql-bugs@postgresql.org; Sat, 08 Mar 2014 03:55:26 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WM8M4-00015W-BO for pgsql-bugs@postgresql.org; Sat, 08 Mar 2014 03:55:23 +0000 MIME-Version: 1.0 Subject: BUG #9485: RFE - cycling sequence rollover to do modulo To: pgsql-bugs@postgresql.org From: Paul.Murray@environment.gov.au Date: Sat, 08 Mar 2014 03:54:56 +0000 Message-ID: <20140308035456.2671.26311@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 ) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs