| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера