Re: Misunderstanding transactions and locks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Michael P(dot) Soulier" <michael_soulier(at)mitel(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Misunderstanding transactions and locks
Date: 2010-06-16 20:37:17
Message-ID: 14198.1276720637@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Excerpts from Michael P. Soulier's message of mi jun 16 12:21:16 -0400 2010:
>> I'm trying to figure out why locking isn't working as I'm expecting. I have a
>> an operation wrapped in a transaction where I explicitely grab an exclusive
>> lock on my table. When another process concurrently runs to do the same, it
>> should block on attempting to acquire the exclusive lock, no?

>> 2010-06-16 12:14:31.913008500 LOG: statement: LOCK TABLE instances IN ROW
>> EXCLUSIVE MODE

> "row exclusive mode" does not block itself.

Specifically, see the table in
http://www.postgresql.org/docs/8.3/static/explicit-locking.html#LOCKING-TABLES

Exclusive lock modes are those that conflict with themselves; to wit,
SHARE ROW EXCLUSIVE mode or higher. The mode names are, um, historical.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-06-16 22:14:12 Re: Dynamic triggers
Previous Message Alvaro Herrera 2010-06-16 20:01:04 Re: Misunderstanding transactions and locks