Re: concurrency problem

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: concurrency problem
Date: 2006-06-19 15:28:50
Message-ID: 20060619152850.GD31354@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)crankycanuck(dot)ca
When my information changes, I alter my conclusions. What do you do sir?
--attr. John Maynard Keynes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Frost 2006-06-19 16:16:43 Re: keeping last 30 entries of a log table
Previous Message Aaron Bono 2006-06-18 21:24:33 Re: concurrency problem