Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 3DE62475F30 for ; Mon, 6 May 2002 16:28:56 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 75DBC47615B for ; Mon, 6 May 2002 16:16:41 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g46KGWv18257; Mon, 6 May 2002 16:16:32 -0400 (EDT) To: Joel Stevenson Cc: pgsql-admin@postgresql.org Subject: Re: SERIAL Field In-reply-to: References: <20010507124341.00EE03F43@bast.unixathome.org> <20010507142738.DE7B63F43@bast.unixathome.org> Comments: In-reply-to Joel Stevenson message dated "Mon, 06 May 2002 12:29:17 -0700" Date: Mon, 06 May 2002 16:16:31 -0400 Message-ID: <18254.1020716191@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200205/39 X-Sequence-Number: 4214 Joel Stevenson 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