Re: Insert Data and autonumeric field

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Insert Data and autonumeric field
Date: 2007-02-01 18:13:05
Message-ID: 20070201181305.GC7985@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Feb 01, 2007 at 04:09:22PM -0300, André José Guergolet wrote:
> PROBLEM: Many clients are getting duplicated IDs.
>
> What is the best way of doing this?

Use a sequence. You can get the current value of the sequence with
SELECT currval('seqname'). No, there's not a race condition; see the
docs.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
Information security isn't a technological problem. It's an economics
problem.
--Bruce Schneier

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-02-01 18:32:19 Re: Insert Data and autonumeric field
Previous Message Andrew Sullivan 2007-02-01 15:48:34 Re: Compilation Error AIX