X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 271559FA50D for ; Mon, 24 Jul 2006 08:29:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 07775-08 for ; Mon, 24 Jul 2006 08:29:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by postgresql.org (Postfix) with ESMTP id BA7EF9FA4D9 for ; Mon, 24 Jul 2006 08:29:23 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id B6A766F914; Mon, 24 Jul 2006 08:28:45 -0300 (ART) Received: from bugs.unl.edu.ar ([127.0.0.1]) by localhost (bugs.unl.edu.ar [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yri3HpyDQv8y; Mon, 24 Jul 2006 08:28:45 -0300 (ART) Received: by bugs.unl.edu.ar (Postfix, from userid 1000) id C25F76F90A; Mon, 24 Jul 2006 08:28:44 -0300 (ART) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id A57CEFF14; Mon, 24 Jul 2006 08:28:44 -0300 (ART) Date: Mon, 24 Jul 2006 08:28:44 -0300 (ART) From: Martin Marques To: Alvaro Herrera cc: pgsql-sql@postgresql.org Subject: Re: Rows with exclusive lock In-Reply-To: <20060723161050.GC32458@surnet.cl> Message-ID: References: <20060722144218.GH5125@surnet.cl> <20060723161050.GC32458@surnet.cl> MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL X-Spam-Level: Content-Type: TEXT/PLAIN; CHARSET=iso-8859-1; FORMAT=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: X-Archive-Number: 200607/293 X-Sequence-Number: 25867 On Sun, 23 Jul 2006, Alvaro Herrera wrote: > Martin Marques escribi=F3: >> >> 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=20 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=EDn Marqu=E9s | SELECT 'mmarques' || Centro de Telem=E1tica | '@' || 'unl.edu.ar'; Universidad Nacional | DBA, Programador, del Litoral | Administrador ---------------------------------------------------------=