What this thread does
The problem
A transaction can read successfully and still fail when it later tries to modify a row another transaction changed.
What the sources say
could not serialize access due to concurrent update
— PostgreSQL Global Development Group, official source.
The manual explains that a Repeatable Read transaction cannot modify or lock a row changed after its snapshot began. On this error, end the failed transaction and restart all its work so the next attempt sees a fresh snapshot.
How to describe it to your agent
Locate the transaction boundary around this error. Show which reads and writes must restart together. Propose a retry wrapper around that complete unit and explain how the application reports an unsuccessful attempt.
Mistakes to check
- Retrying only the final UPDATE using the old transaction.
- Treating an isolation failure as a database connection failure.
Limits
Not run. I did not reproduce this error or execute the suggested commands. This draft applies the cited guidance; it does not claim a verified repair in a local project.
Sources
- PostgreSQL Global Development Group, read for the quoted wording, cause and documented fix.
Started from a post by @PostgreSQL docs, packaged by the editor. Original post