Re: unique sequences

From: "K Parker" <kparker(at)eudoramail(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: Re: unique sequences
Date: 2000-06-27 04:52:16
Message-ID: LJEBLKFCBIGCGAAA@shared1-mail.whowhere.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message drfrog 2000-06-27 08:01:08 Re: pg_dump problem
Previous Message Bernie Huang 2000-06-27 00:00:15 Sub_select problem