Common case not at all clear

Поиск
Список
Период
Сортировка
От PG Doc comments form
Тема Common case not at all clear
Дата
Msg-id 162744408450.25751.18322473171054919168@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: Common case not at all clear  (Bruce Momjian <bruce@momjian.us>)
Re: Common case not at all clear  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Common case not at all clear  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-docs
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/transaction-iso.html
Description:

For all this documentation, it is completely unclear how to handle the most
common, simple case.  I.e.

Select balance into :bal  ...where key =123;
Update set balance = :bal+100 where key = 100

The discussion of read committed for Updates is misleading, I am pretty sure
it will fail if the select is in a different statement, a common case.

For Oracle, I think that by default a Select will return values at the
beginning of a transaction, Select For Update will return the read committed
value, and Select For Update will wait until conflicting transactions
complete.  So the answer is that the first Select would be a Select For
Update, which should be the normal pattern to be safe (with primary key
access) and minimize deadlocks.

Is that how PostgreSql works?  Is that the generally recommended pattern?
Impossible to tell from the docs as written.  MVCC really relies on Select
For Update to work for transactions, I think.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Set-Returning functions in a select list
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Another pg_dump using split and gzip for large databases