Skip site navigation (1) Skip section navigation (2)

Re: Re: unique sequences

From: "DalTech - Continuing Technical Education" <CTE(at)Dal(dot)Ca>
To: <kparker(at)eudoramail(dot)com>
Cc: <pgsql-sql(at)hub(dot)org>
Subject: Re: Re: unique sequences
Date: 2000-06-27 11:12:16
Message-ID: 006601bfe028$8da6dd60$5911be86@cte.Dal.Ca (view raw or flat)
Thread:
Lists: pgsql-sql
I imagine it should if you create a unique index on the field.

Cheers,
Christopher Currie


----- Original Message -----
From: K Parker <kparker(at)eudoramail(dot)com>
To: <pgsql-sql(at)hub(dot)org>
Sent: Tuesday, June 27, 2000 1:52 AM
Subject: [SQL] Re: unique sequences


> > 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


In response to

pgsql-sql by date

Next:From: Emils KlotinsDate: 2000-06-27 13:09:01
Subject: Backup?
Previous:From: drfrogDate: 2000-06-27 08:01:08
Subject: Re: pg_dump problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group