Re: concurrency problem - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: concurrency problem
Date
Msg-id 20060619152850.GD31354@phlogiston.dyndns.org
Whole thread Raw
In response to Re: concurrency problem  ("sathish kumar shanmugavelu" <sathishkumar.shanmugavelu@gmail.com>)
List pgsql-sql
On Sat, Jun 17, 2006 at 09:23:17AM +0530, sathish kumar shanmugavelu wrote:
>   I fetch the consultatioin_no and add one to it, i should know this
> consultation_no to save the other 10 tables. because i use this number as

Don't do that.  Fetch the number from a sequence first: select
nextval().  Then you can insert it as currval() for all your other
INSERTs.  No, there is no race condition or concurrency problem: see
the docs on these functions.  No locks.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
When my information changes, I alter my conclusions.  What do you do sir?    --attr. John Maynard Keynes


pgsql-sql by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: concurrency problem
Next
From: Jeff Frost
Date:
Subject: Re: keeping last 30 entries of a log table