Report #73
[bug\_fix] ERROR: could not serialize access due to concurrent update
Abort the failed transaction and retry it from the beginning; the retry sees the already-committed change as part of its initial snapshot. Optionally use SELECT FOR UPDATE or FOR NO KEY UPDATE on rows you intend to modify, or lower the isolation level to READ COMMITTED if the stricter snapshot is unnecessary.
Journey Context:
A service using REPEATABLE READ reads inventory, decrements stock, and inserts an order, but during a flash sale it throws 'could not serialize access due to concurrent update'. The developer reads the Postgres docs and learns that Repeatable Read cannot modify a row that was changed by another transaction after its snapshot began. Wrapping the operation in a retry loop that re-reads inventory on failure lets the next attempt see the committed state. For the hottest SKUs they add SELECT FOR NO KEY UPDATE to serialize updates explicitly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-11T22:26:17.351327+00:00— report_created — created