Re: postgres transaction isolation when rollback

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: postgres transaction isolation when rollback
Дата
Msg-id 22534.1151897233@sss.pgh.pa.us
обсуждение исходный текст
Ответ на postgres transaction isolation when rollback  ("Tomer Levinboim" <levinboim.tomer@gmail.com>)
Список pgsql-novice
"Tomer Levinboim" <levinboim.tomer@gmail.com> writes:
> Suppose now that the order is like so
> transaction 1: UPDATE accounts SET balance = balance + 100.00 WHERE acctnum
> = 12345;
> transaction 2: UPDATE accounts SET balance = balance + 200.00 WHERE acctnum
> = 12345;
> transaction 1: transaction failure
> transaction 2: UPDATE accounts SET balance = balance - 200.00 WHERE acctnum
> = 7534;

> Would the balance of account 12345 increase by 200 or 300 ?

200.  Transaction 2 will block at its first UPDATE waiting to see if
transaction 1 commits or not, and will then use the appropriate version
of the row as the starting point for its update.

(I'm assuming you're speaking of READ COMMITTED rules here --- if T2
is SERIALIZABLE then the answer is different.)

            regards, tom lane

В списке pgsql-novice по дате отправления:

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Insert more then one row
Следующее
От: "Guido Barosio"
Дата:
Сообщение: Re: Password Help?