Re: Curosity question regarding "LOCK" NOWAIT - Mailing list pgsql-general

From Josh Kupershmidt
Subject Re: Curosity question regarding "LOCK" NOWAIT
Date
Msg-id CAK3UJRG2pxqZ_LwM0uTVfOgYMM7R3xo1md7XDoFD7cTvyHY7Ew@mail.gmail.com
Whole thread Raw
In response to Curosity question regarding "LOCK" NOWAIT  ("David Johnston" <polobo@yahoo.com>)
Responses Re: Curosity question regarding "LOCK" NOWAIT
List pgsql-general
On Fri, Sep 21, 2012 at 7:43 PM, David Johnston <polobo@yahoo.com> wrote:
> Has there been any discussion regarding adding a time-limited version of
> NOWAIT, say: “WAITONLY 50” (milliseconds), when dealing the explicit LOCK
> TABLE or the SELECT…FOR(SHARE|UPDATE) commands?

I think you could do this by issuing

   SET statement_timeout = 50;

and then attempting the LOCK TABLE or SELECT ... FOR UPDATE command,
without NOWAIT. You'll either get an "ERROR:  canceling statement due
to statement timeout" or the command should succeed.

Josh


pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Curosity question regarding "LOCK" NOWAIT
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: Curosity question regarding "LOCK" NOWAIT