Re: Insert Data and autonumeric field - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: Insert Data and autonumeric field
Date
Msg-id 20070201181305.GC7985@phlogiston.dyndns.org
Whole thread Raw
In response to Insert Data and autonumeric field  (André José Guergolet <AGuergolet@compugraf.com.br>)
List 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@crankycanuck.ca
Information security isn't a technological problem.  It's an economics
problem.    --Bruce Schneier


pgsql-sql by date:

Previous
From: André José Guergolet
Date:
Subject: Insert Data and autonumeric field
Next
From: Tom Lane
Date:
Subject: Re: Insert Data and autonumeric field