cockroachdb / cockroachdb/cockroach
sql: return error code `40P01` for transaction deadlocks
Open
A-sql-pgcompat
C-enhancement
E-quick-win
E-starter
T-sql-foundations
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
We currently return a `40001` error when deadlocks are detected between transactions and one transaction is aborted. This is different than PostgreSQL, which returns a `40P01` error. We should do the same.
When doing so, we'll need to be conscious that applications may have built retry loops around `40001` errors. If we start returning a new error code and these retry loops were helping to retry after transaction deadlocks, they'll need to be updated.
Jira issue: CRDB-34639
Epic CRDB-60942
Contributor guide
Assessment
This issue has not been assessed yet.