X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 86B809FA65C for ; Thu, 4 May 2006 15:48:16 -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 05585-04 for ; Thu, 4 May 2006 15:47:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from r1.mycybernet.net (r1.mycybernet.net [209.5.206.8]) by postgresql.org (Postfix) with ESMTP id 285DA9F9B76 for ; Thu, 4 May 2006 15:47:50 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227]:50706 helo=phlogiston.dydns.org) by r1.mycybernet.net with esmtp (Exim 4.50 (FreeBSD)) id 1Fbird-0005RA-Hz for pgsql-sql@postgresql.org; Thu, 04 May 2006 14:47:49 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id B6B644051; Thu, 4 May 2006 14:47:48 -0400 (EDT) Date: Thu, 4 May 2006 14:47:48 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: is an explicit lock necessary? Message-ID: <20060504184748.GD21437@phlogiston.dyndns.org> References: <20060504181056.14509.qmail@web52510.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060504181056.14509.qmail@web52510.mail.yahoo.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/52 X-Sequence-Number: 25083 On Thu, May 04, 2006 at 11:10:56AM -0700, Ash Grove wrote: > Hi, > > Does beginning a transaction put locks on the tables > queried within the transaction? You mean like a table lock? No. A transaction does entail some locks: for instance, an access exclusive lock will block behind your share lock while you're looking at the table (because the exclusive lock wants to be exclusive, of course). See the concurrency control section of the manual. > In the example below, is #2 necessary? My thought was No. currval() is local to your _session_ (not even your transaction). The docs explain how this works. A -- Andrew Sullivan | ajs@crankycanuck.ca A certain description of men are for getting out of debt, yet are against all taxes for raising money to pay it off. --Alexander Hamilton