pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Hammond <andrew.george.hammond@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Rows with exclusive lock
Date: 26 Jul 2006 12:25:31 -0700
Message-ID: <1153941931.290674.125300@b28g2000cwb.googlegroups.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0607240812500.701@bugs.unl.edu.ar>
References: <Pine.LNX.4.64.0607221135470.17932@bugs.unl.edu.ar>
	<20060722144218.GH5125@surnet.cl>
	<Pine.LNX.4.64.0607221151080.17932@bugs.unl.edu.ar>
	<20060723161050.GC32458@surnet.cl>
	<Pine.LNX.4.64.0607240812500.701@bugs.unl.edu.ar>


Martin Marques wrote:
> 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.

Well... you could change your other selects to use FOR UPDATE as well,
even if they're not going to be updating (but this block concurrent
reads). You're probably better to take Alvaro's suggestion above and
use SELECT FOR SHARE.

Drew




view thread (7+ messages)

Message-ID: <1153941931.290674.125300@b28g2000cwb.googlegroups.com>
Permalink:  ../1153941931.290674.125300@b28g2000cwb.googlegroups.com/
Also on:    postgresql.org/message-id/1153941931.290674.125300@b28g2000cwb.googlegroups.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andrew.george.hammond@gmail.com
  Subject: Re: Rows with exclusive lock
  In-Reply-To: <1153941931.290674.125300@b28g2000cwb.googlegroups.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox