Re: in transaction - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: in transaction
Date
Msg-id 20050820032932.GA18659@surnet.cl
Whole thread Raw
In response to Re: in transaction  (elein@varlena.com (elein))
List pgsql-general
On Fri, Aug 19, 2005 at 06:01:40PM -0700, elein wrote:

> To replicate the situation in psql:
>     BEGIN;
>     select something;
>
> In another window I see that I have not only shared access locks
> but an exclusive access lock.  I do not understand why the exclusive
> lock is there.  Am I seeing ghosts?

No, it's the lock on the transaction's own TransactionId.  It's harmless
until the transaction updates a tuple that some other transaction later
wants to update too.  You should be able to see it too if you don't
issue the SELECT.  The point of the modification I was indicating is to
delay the acquisition of such a lock until the transaction actually does
something, like that SELECT.  (So if the client does exactly what you
did, it wouldn't be solved by my proposed change.)

--
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"In a specialized industrial society, it would be a disaster
to have kids running around loose." (Paul Graham)

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Upgrade OS from Redhat AS3 (2.4 kernel) to AS4 (2.6)
Next
From: CSN
Date:
Subject: Suggestion for Date/Time Functions Section