Yep, we get asked to do that quite often.  Use statement_timeout before
the LOCK command.  If the timeout happens, the LOCK, and hence
transaction will abort.

---------------------------------------------------------------------------

The Hermit Hacker wrote:
> 
> Simple (I think) question ... is there a way of having an application
> attempt to acquire a LOCK on a table *without* it blocking?  Right now, if
> you try to LOCK a table that another process has LOCKed, it will hang
> indefinitely waiting for the other LOCK to drop ... is there a way of
> setting a 'timer' so that if it doesn't acquire a LOCK in n secs, it just
> fails and reports it back to the application?
> 
> Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
> Systems Administrator @ hub.org
> primary: [EMAIL PROTECTED]           secondary: [EMAIL PROTECTED]|postgresql}.org
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to