Re: Procedure - how to lock some records in table

From: Robert Klemme <>
Date: Wed, 13 Aug 2008 23:01:11 +0200
Message-ID: <>

On 13.08.2008 18:27, joel garry wrote:
> On Aug 13, 7:49 am, PiotreK <> wrote:
>> On 13 Sie, 15:41, "" <> >> wrote:

>> Again in some performance test by grinder the same group sometimes is
>> taken by two different users... I don't have a clue why it is like
>> this...

> Please read the concepts manual about when a transaction begins. You
> have two different users taking the group because the two users each
> have a read consistent view of the database as it exists when their
> transaction starts, which says the group is available. If you select
> for update, the second one will not be able to update because he will
> be locked out. Your code needs to handle that.

Another remark: I don't see the need for all this dynamic SQL. Also, it might be that the whole thing can be solved with one (a single UPDATE) or two (SELECT ... FOR UPDATE and then UPDATE) SQL statements doing set operations.

Btw, I spotted a missing "THEN" - so that code seems to not even be syntactically correct.

Kind regards

        robert Received on Wed Aug 13 2008 - 16:01:11 CDT

Original text of this message