From: Jim C. Nasby <jim@nasby.net>
To: Mathias Laurent <e1lauren@hotmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: SELECT FOR UPDATE NOWAIT
Date: Thu, 28 Sep 2006 14:23:17 -0500
Message-ID: <20060928192317.GY34238@nasby.net> (raw)
In-Reply-To: <BAY112-F69231CB85D5278395F9F19A1B0@phx.gbl>
References: <1d219a6f0609280810j5e156f33uaafbb37c17ee5d5d@mail.gmail.com>
<BAY112-F69231CB85D5278395F9F19A1B0@phx.gbl>
On Thu, Sep 28, 2006 at 03:26:36PM +0000, Mathias Laurent wrote:
> If I do :
> Session 1:
> decibel=# begin;
Does decibel have some meaning in some language other than english?
> BEGIN
> decibel=# select * from i where i=1 for update nowait;
> i
> ---
> 1
> (1 row)
>
> decibel=# begin;
> BEGIN
> decibel=# select * from i where i=2 for update nowait;
> i
> ---
> 2
> (1 row)
>
> Session 2 :
>
> decibel=# select * from i where i=1 for update nowait;
> ERROR: could not obtain lock on row in relation "i"
> decibel=# select * from i where i=3 for update nowait;
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block
> decibel=# ==> Why ? :'(
>
> Why i can't do any "Select for update" (current transaction aborted) after
> having receive a not obtain lock ???
> Thank you for your answer !
Because as soon as there is an error in a transaction, the entire
transaction is void. You have to rollback the transaction (or return to
a savepoint).
--
Jim Nasby jim@nasby.net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: jim@nasby.net, e1lauren@hotmail.com
Subject: Re: SELECT FOR UPDATE NOWAIT
In-Reply-To: <20060928192317.GY34238@nasby.net>
References: <1d219a6f0609280810j5e156f33uaafbb37c17ee5d5d@mail.gmail.com> <BAY112-F69231CB85D5278395F9F19A1B0@phx.gbl> <20060928192317.GY34238@nasby.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox