John Sidney-Woollett wrote:
> I'd have to sit down and think about the answer to that and I'm too
> tired right now... ;)
>
> We found the NOWAIT option very useful for helping to get our stored
> procedures to behave in a more deterministic way, especially in a
> multi-threaded environment.
>
> John Sidney-Woollett
>
> Jim C. Nasby wrote:
>
>> Ahh, yes, forgot about that. Very handy to have. But even without that
>> you wouldn't have a race condition, just a blocked process, right?
>>
Not sure if this should be that way - the docs say that in case
of locked rows the where clause is reevaluated:
1 session: lock row, update status.
2 session:
test=# select * from test2 where nr=(select max(nr) from test2
where status='NEW') for update;
<waits here>
1. session commit;
2.session results:
nr | status
----+------------
55 | PROCESSING
(1 row)
test=#
Andre