Thread: Detecting locks

Detecting locks

From
Sebastian Bossung
Date:
Hi,

how do you find out if a row is locked _before_ using SELECT ... FOR UPADTE
on it. The SELECT will wait for the lock to be removed (if there was one),
making the user think the app crashed.

Sebastian

--
Sebastian Boßung - bossung@gmx.de
http://www.bossung.org
# The idea is to die young as late as possible.

Re: Detecting locks

From
Peter Eisentraut
Date:
Sebastian Bossung writes:

> how do you find out if a row is locked _before_ using SELECT ... FOR UPADTE
> on it. The SELECT will wait for the lock to be removed (if there was one),
> making the user think the app crashed.

There is currently no way to detect locks.  You could implement a timeout
in your application after which you send a query cancel.  A waiting lock
still distinguishes it from a crashed program, ISTM.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter