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