Re: lock row in table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Michał <danielosch(at)o2(dot)pl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: lock row in table
Date: 2003-08-28 13:38:33
Message-ID: 10885.1062077913@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

=?iso-8859-2?Q?Daniel_Micha=B3?= <danielosch(at)o2(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Faulkner 2003-08-28 14:37:55 Re: length of array
Previous Message Brett Dikeman 2003-08-28 13:23:35 interval conversion