Take a look at the Transaction Isolation section of the PG docs, particularly 12.2.1. Read Committed Isolation Level. According to this section of the docs, PG will never perform a "dirty read" which looks like what you're worried about. However, under the (default) Read Commited isolation level it is possible in certain limited cases for a transaction's view of the database to be changed by concurrent transactions (nonrepeatable and phantom reads). If this is a problem you need to bump yourself up to Serializable transaction isolation, and be prepared to re-execute any updates that fail.