Re: lock row in table - Mailing list pgsql-sql

From Tom Lane
Subject Re: lock row in table
Date
Msg-id 10885.1062077913@sss.pgh.pa.us
Whole thread Raw
In response to lock row in table  (Daniel Michał <danielosch@o2.pl>)
List pgsql-sql
Daniel Michał <danielosch@o2.pl> writes:
> I have to lock one row in table1 for user1. In the same time other users sh=
> ould be able to read this record but when other user for example user2 want=
>  to edit this record  user2 should get information "The row you try to edit=
>  is currently edit" - or sometihing similar.

> Of course I can lock record with syntax "Begin; select * from table1 where =
> ID=3D12 for update; update table1 set field1=3D"New value" where ID=3D12; c=
> ommit;"
> but I can not to inform other user that the record is edited?

Try using the contrib/userlock/ functions.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Daniel"
Date:
Subject: Re: lock row in table
Next
From: "Brett Dikeman"
Date:
Subject: interval conversion