Re: is an explicit lock necessary?

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: is an explicit lock necessary?
Date: 2006-05-04 18:47:48
Message-ID: 20060504184748.GD21437@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)crankycanuck(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2006-05-04 18:50:24 Re: is an explicit lock necessary?
Previous Message Ash Grove 2006-05-04 18:10:56 is an explicit lock necessary?