pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: concurrency problem
Date: Mon, 19 Jun 2006 11:28:50 -0400
Message-ID: <20060619152850.GD31354@phlogiston.dyndns.org> (raw)
In-Reply-To: <ee0ad3a30606162053j1533b7e2o16d05a7e0fe7d944@mail.gmail.com>
References: <ee0ad3a30606152114g122d0021ja7c603a8f36ae62c@mail.gmail.com>
	<20060616140855.72700.qmail@web52513.mail.yahoo.com>
	<ee0ad3a30606162053j1533b7e2o16d05a7e0fe7d944@mail.gmail.com>

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



view thread (21+ messages)

Message-ID: <20060619152850.GD31354@phlogiston.dyndns.org>
Permalink:  ../20060619152850.GD31354@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20060619152850.GD31354@phlogiston.dyndns.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ajs@crankycanuck.ca
  Subject: Re: concurrency problem
  In-Reply-To: <20060619152850.GD31354@phlogiston.dyndns.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox