X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4921B9FA64B for ; Mon, 19 Jun 2006 12:29:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 52778-09 for ; Mon, 19 Jun 2006 12:29:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id D75EA9FA3AF for ; Mon, 19 Jun 2006 12:29:00 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1FsLls-0008ID-7j for pgsql-sql@postgresql.org; Mon, 19 Jun 2006 11:34:36 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 4D8994051; Mon, 19 Jun 2006 11:28:50 -0400 (EDT) Date: Mon, 19 Jun 2006 11:28:50 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: concurrency problem Message-ID: <20060619152850.GD31354@phlogiston.dyndns.org> References: <20060616140855.72700.qmail@web52513.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/226 X-Sequence-Number: 25462 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