Re: SERIAL Field - Mailing list pgsql-admin

From Tom Lane
Subject Re: SERIAL Field
Date
Msg-id 18254.1020716191@sss.pgh.pa.us
Whole thread Raw
In response to Re: SERIAL Field  (Joel Stevenson <jstevenson@bearriver.com>)
Responses Re: SERIAL Field  (Joel Stevenson <jstevenson@bearriver.com>)
List pgsql-admin
Joel Stevenson <jstevenson@bearriver.com> writes:
> Though, if you have multiple clients inserting into the table, there
> is a chance that between client A inserting the record and then
> calling currval(), client B could have performed an insert, in which
> case client A gets the value of client B's record.  'nextval() +
> write' avoids this possible overlap.

People who have not studied the documentation frequently make that
claim.  *There is no such risk* (unless A and B are interleaving their
commands on a single database connection, in which case they have lots
worse risks of conflicts than this one).  See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-sequence.html

            regards, tom lane

pgsql-admin by date:

Previous
From: Joel Stevenson
Date:
Subject: Re: SERIAL Field
Next
From: Joel Stevenson
Date:
Subject: Re: SERIAL Field