Detect Locked Row Without Blocking - Mailing list pgsql-general

From Joe Lester
Subject Detect Locked Row Without Blocking
Date
Msg-id b88164e8e1d59d4801253516ae3987a3@sweetwater.com
Whole thread Raw
Responses Re: Detect Locked Row Without Blocking  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Is there a recommended "postgres way" to determine if a certain row is
locked... without blocking?

In my custom postgres client app I'd like to be able to determine if
another user is "modifying" a given record. If so, I would present a
dialog to the user such as "Record Locked. Sam Smith is already
modifying this record. Try again later."

I've looked at SELECT FOR UPDATE which looks good except for that it
blocks. I don't want my UI to freeze up... I just want to notify the
user that it's locked and move on. Any thoughts?

Thanks.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Connect to a database in a .sql file
Next
From: Richard Huxton
Date:
Subject: Re: Connect to a database in a .sql file