Thread: How to know whether a table is locked ?

How to know whether a table is locked ?

From
"Nicolas Bazin"
Date:
I read a thread about table lock timeout but don't know whether anything has been done about it.
 
Here is what I'd like to do:
I don't want my transactions to be on hold for too long so I'd like to use a syntax I use on INFORMIX already:
SET LOCK MODE TO [WAIT [second] | NOT WAIT]
I'm using ecpg and I think I'm up to make a patch to it to support the WAIT [second] with the asynchronous functions but I need a way to know whether a statement would lock from the back-end to implement the NOT WAIT.
Is there a way?

Re: How to know whether a table is locked ?

From
Bruce Momjian
Date:
Nicolas Bazin wrote:
> I read a thread about table lock timeout but don't know whether
> anything has been done about it.
> 
> Here is what I'd like to do:  I don't want my transactions to
> be on hold for too long so I'd like to use a syntax I use on
> INFORMIX already:  SET LOCK MODE TO [WAIT [second] | NOT WAIT]
> I'm using ecpg and I think I'm up to make a patch to it to
> support the WAIT [second] with the asynchronous functions but
> I need a way to know whether a statement would lock from the
> back-end to implement the NOT WAIT.  Is there a way?

We are discussing a SET timeout parameter that would do something
similar.  However, it will not be done until 7.3, at the earliest.  The
only solution right now would be to do an alarm() and issue a query
cancel after the alarm sounds.

-- Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026