Re: A simple question about Read committed isolation level - Mailing list pgsql-general

From Tom Lane
Subject Re: A simple question about Read committed isolation level
Date
Msg-id 29626.1080834924@sss.pgh.pa.us
Whole thread Raw
In response to A simple question about Read committed isolation level  (weiping he <laser@qmail.zhengmai.net.cn>)
Responses Re: A simple question about Read committed isolation level
List pgsql-general
weiping he <laser@qmail.zhengmai.net.cn> writes:
> txn1: txn2:
> begin; begin;
> update table_a set col= col + 1; update table_a set col = col + 1;
> end; end;

> if two transaction begin at exact the same time,
> what's the result of 'col' after both transactions committed
> in Read committed level? it's 3 or 2?
> My understanding is the result is 3,

If the second xact to lock the row is READ COMMITTED, you get 3.
If it's SERIALIZABLE you get an error.  In no case will you silently
lose an update.

            regards, tom lane

pgsql-general by date:

Previous
From: Randall Skelton
Date:
Subject: Select Union
Next
From: Stephan Szabo
Date:
Subject: Re: select distinct w/order by