Identifying error due to Serializable isolation failure in postgres

I have a transaction with serializable isolation level
db.transaction((tx) => {....}, {isolationLevel: "serializable"})
db.transaction((tx) => {....}, {isolationLevel: "serializable"})
Based on the postgres documentation I have to retry it whenever postgres is unable to guarantee the Serializable isolation level. The error raised by the postgres when I have to retry is
ERROR: could not serialize access due to read/write dependencies among transactions
ERROR: could not serialize access due to read/write dependencies among transactions
Link to the postgres documentation (https://www.postgresql.org/docs/current/transaction-iso.html) My question is to how to identify the above error so that I can retry only when the error occurs due to above case. I can't retry every time there is an error. Thanks!!
PostgreSQL Documentation
13.2. Transaction Isolation
13.2. Transaction Isolation # 13.2.1. Read Committed Isolation Level 13.2.2. Repeatable Read Isolation Level 13.2.3. Serializable Isolation Level The SQL standard …
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?