Unix Technical Forum

Problem with SELECT FOR UPDATE NOWAIT

This is a discussion on Problem with SELECT FOR UPDATE NOWAIT within the pgsql Admins forums, part of the PostgreSQL category; --> Hello, Veiled I have a small problem which I have solved in a way not very clean, I would ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 06:00 AM
Mathias Laurent
 
Posts: n/a
Default Problem with SELECT FOR UPDATE NOWAIT

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 06:02 AM
Jim C. Nasby
 
Posts: n/a
Default Re: Problem with SELECT FOR UPDATE NOWAIT

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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:35 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com