pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Raymond Pau <rpau@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to make sequence skip existing key in table?
Date: Tue, 18 Feb 2003 07:43:11 -0600
Message-ID: <20030218134311.GB11307@wolff.to> (raw)
In-Reply-To: <20030218100134.91784.qmail@web14204.mail.yahoo.com>
References: <3E51F36A.75F42D3@rodos.fzk.de>
	<20030218100134.91784.qmail@web14204.mail.yahoo.com>

On Tue, Feb 18, 2003 at 02:01:34 -0800,
  Raymond Pau <rpau@yahoo.com> wrote:
> Hi List,

Please don't start new threads by replying to other messages on the list.
This screws up threading of messages, which is useful for following specific
discussions.

> I am using sequence to generate to a list of unique
> key id that will be used as the primary key for some
> tables.
> 
> My question is when the sequence wraps over to the
> minimum value(1), how can I ensure that the next id is
> not in the tables?

My suggestion is to use the bigserial type. This uses bigint as the underlying
type and you are not likely to roll over a 64 bit integer unless you are
wasting a lot of serial values for each one you actually use.



view thread (4+ messages)  latest in thread

Message-ID: <20030218134311.GB11307@wolff.to>
Permalink:  ../20030218134311.GB11307@wolff.to/
Also on:    postgresql.org/message-id/20030218134311.GB11307@wolff.to

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, rpau@yahoo.com
  Subject: Re: How to make sequence skip existing key in table?
  In-Reply-To: <20030218134311.GB11307@wolff.to>

* 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