Serialization
Now, if the idea that UPDATE and DELETE statements made by other sessions will leak into your view of the database state even within a transaction horrifies you, what you probably want is the other transaction isolation method: serializable.
There are actually two slightly different MVCC modes available in PostgreSQL to help address different requirements here. These reflect two behaviors from the SQL standard, introduced at http://www.postgresql.org/docs/current/static/transaction-iso.html. The problems described there, such as non-repeatable and phantom reads, require using the database's more complicated serializable mode to avoid them, instead of the simpler and default Read Committed transaction model. It's worth reading ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access