Re: SERIAL Field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joel Stevenson <jstevenson(at)bearriver(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: SERIAL Field
Date: 2002-05-06 20:16:31
Message-ID: 18254.1020716191@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Joel Stevenson <jstevenson(at)bearriver(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joel Stevenson 2002-05-06 20:57:40 Re: SERIAL Field
Previous Message Joel Stevenson 2002-05-06 19:29:17 Re: SERIAL Field