Re: Question about SELECT FOR UPDATE in transaction, isolation level - Mailing list pgsql-general

From Tom Lane
Subject Re: Question about SELECT FOR UPDATE in transaction, isolation level
Date
Msg-id 4331.987178942@sss.pgh.pa.us
Whole thread Raw
In response to Question about SELECT FOR UPDATE in transaction, isolation level  (Al <alexm%innocent.com@news.tht.net>)
List pgsql-general
Al <alexm%innocent.com@news.tht.net> writes:
> begin work;
> select val from ids where cntr='ct1' for update;
> update ids set val=val+(some integer value) where cntr='ct1';
> commit work;

Looks reasonable.

> However, when I run everything except the commit on one terminal and
> then run up to and including the select on another terminal, I receive
> the OLD, non-updated value for val on that second terminal. In other
> words, the select is not blocked and the id is not unique.

Hm, it works for me.  You sure you remembered to use select FOR UPDATE
in both transactions?

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: updates way slower than selects?
Next
From: "Justin S."
Date:
Subject: Shared memory failure?