pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jnasby@pervasive.com>
To: Mathias Laurent <e1lauren@hotmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Problem with SELECT FOR UPDATE NOWAIT
Date: Thu, 20 Apr 2006 17:47:38 -0500
Message-ID: <20060420224737.GP49405@pervasive.com> (raw)
In-Reply-To: <BAY112-F31DF679F7653CFD2835DD19AC30@phx.gbl>
References: <BAY112-F31DF679F7653CFD2835DD19AC30@phx.gbl>

I think you're confused about what actually happened...

Session 1:
decibel=# select * from a;
 i 
---
 1
(1 row)

decibel=# begin;
BEGIN
decibel=# select * from a for update nowait;
 i 
---
 1
(1 row)

decibel=# 

Session 2:
decibel=# select * from a for update nowait;
ERROR:  could not obtain lock on row in relation "a"
decibel=# select * from a for update;

...waits...

Session 1:
decibel=# rollback;
ROLLBACK
decibel=# 

And immediately in session 2:
 i 
---
 1
(1 row)

decibel=# 

On Thu, Apr 13, 2006 at 01:57:47AM +0000, Mathias Laurent wrote:
> Hello,
> 
> Veiled I have a small problem which I have solved in a way not very clean, 
> I would thus like to have your opinion. When I made with the process 1 :
> 
> Select * FROM myTable WHERE num=3 FOR UPDATE NOWAIT
> 
> And that I remade it with a process 2 before having do one "Commit" It 
> blocked me (until there normal)
> But once that I free by doing one "Commit" with process 1 All the table 
> remains to block for process 2...
> To have access it, it is necessary that I do one "Commit" with the 
> processus2 !! It's very strange...
> 
> Thank you,
> 
> Mathias Laurent
> 
> _________________________________________________________________
> Windows Live Mail : d?couvrez et testez la version b?ta ! 
> http://www.ideas.live.com/
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>               http://www.postgresql.org/docs/faq
> 

-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461



view thread (3+ messages)  latest in thread

Message-ID: <20060420224737.GP49405@pervasive.com>
Permalink:  ../20060420224737.GP49405@pervasive.com/
Also on:    postgresql.org/message-id/20060420224737.GP49405@pervasive.com

 · 

reply

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: jnasby@pervasive.com, e1lauren@hotmail.com
  Subject: Re: Problem with SELECT FOR UPDATE NOWAIT
  In-Reply-To: <20060420224737.GP49405@pervasive.com>
  References: <BAY112-F31DF679F7653CFD2835DD19AC30@phx.gbl> <20060420224737.GP49405@pervasive.com>

* 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