pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: K Parker <kparker@eudoramail.com>
To: pgsql-sql@hub.org
Subject: Re: unique sequences
Date: Mon, 26 Jun 2000 21:52:16 -0700
Message-ID: <LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com> (raw)

> Rather, each time you wish to do an insert,
> query the existing data to see what the
> maximum value is existing in the database.
> Add 1 to that and use this as your new value.
> This is guaranteed to not have any holes in
> the sequence.

True, but alas it _doesn't_ guarantee uniqueness, since there's nothing to prohibit 2 or more back ends getting the same max() at the
same time...

Thinking off the top of my head, I'm not sure you can apply FOR UPDATE to an aggregate function, so there's probably no solution there, either.



Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com



view thread (2+ messages)  latest in thread

Message-ID: <LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com>
Permalink:  ../LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com/
Also on:    postgresql.org/message-id/LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com

 · 

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-sql@postgresql.org
  Cc: kparker@eudoramail.com, pgsql-sql@hub.org
  Subject: Re: unique sequences
  In-Reply-To: <LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com>
  References: <LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com>

* 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