Re: update table with row locking

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Mark <sendmailtomark(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: update table with row locking
Date: 2004-12-23 20:33:03
Message-ID: 20041223203303.GA68180@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 23, 2004 at 11:56:26AM -0800, Mark wrote:

> Is it possible to lock row(s) when updating a table, so another call
> for update( from different session) will be rejected and to be on
> hold until lock get released ?

The UPDATE statement automatically acquires locks, but if you need
more control then you could use SELECT FOR UPDATE or LOCK. For
more information see the "Concurrency Control" chapter in the
documentation.

What problem are you trying to solve? Depending on what you're
doing, you might not need to use explicit locking.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Együd Csaba (Freemail) 2004-12-23 20:48:56 Re: Very slow stored proc
Previous Message Scott Marlowe 2004-12-23 20:09:15 Re: update table with row locking