Re: Rows with exclusive lock

From: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Rows with exclusive lock
Date: 2006-07-24 11:28:44
Message-ID: Pine.LNX.4.64.0607240812500.701@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 23 Jul 2006, Alvaro Herrera wrote:

> Martin Marques escribió:
>>
>> After the SELECT FOR UPDATE other transactions can still see the locked
>> rows. I want a read/write lock, so no one can access does rows.
>
> SELECT FOR UPDATE acquires an exclusive lock, but other transactions
> must try to acquire a lock on the rows as well, or they won't be locked.
> You can try using SELECT FOR SHARE (new as of 8.1) if you want some
> transactions to hold shared (read) locks.

Sorry for not getting it clear the first time.

What I want is something like "LOCK table IN ACCESS EXCLUSIVE MODE", but
at row level.

> IOW, SELECT FOR UPDATE blocks other SELECTs FOR UPDATE and SELECTs FOR
> SHARE, but it does not block plain SELECT.

So, this is not posible. :-(

--
21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' ||
Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
---------------------------------------------------------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mario Splivalo 2006-07-24 12:12:39 Primary key constraint violation without error?
Previous Message Richard Jones 2006-07-24 08:59:07 Re: Referential integrity (foreign keys) across multiple tables