Re: feature request - update nowait

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Eduardo Piombino <drakorg(at)gmail(dot)com>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: feature request - update nowait
Date: 2011-09-08 16:22:09
Message-ID: CAHyXU0whdqXJkc2GPexcr6AhraB8O1mWutvq8zLX3uj4Z1fsrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 8, 2011 at 4:01 AM, Eduardo Piombino <drakorg(at)gmail(dot)com> wrote:
> Hi, would it be possible to implement a nowait modifier to the update
> statement in order to tell it not to wait and raise an error -just like a
> select for update nowait would-, instead of defaulting to waiting forever
> until the lock becomes available?
>
> The lack of such a modifier nowadays forces me to do a select for update
> before every update on which I need the fastest response possible, and it
> would be great if it could be integrated into the command itself.
>
> Just an idea.

+1

note you may be able to emulate this by sneaking a nolock into the
update statement in a highly circuitous fashion with something like:
update foo set v = 2 from (select 1 from foo where id = 1 for update
nowait) q where id = 1;

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Miguel Angel Hernandez Moreno 2011-09-08 16:25:35 Re: problems with pg_restore and java
Previous Message Merlin Moncure 2011-09-08 16:10:47 Re: problems with pg_restore and java