25003
PostgreSQLERRORNotableInvalid Transaction StateHIGH confidence
inappropriate access mode for branch transaction
What this means
SQLSTATE 25003 is raised when the access mode (READ ONLY vs READ WRITE) specified for a transaction does not match the access mode required by the branch transaction or the current connection state.
Why it happens
- 1Attempting to change the transaction access mode in a way that conflicts with the current session or branch transaction state
How to reproduce
Setting READ WRITE mode in a READ ONLY transaction.
expected output
ERROR: inappropriate access mode for branch transaction
Fix
Set the correct transaction access mode before starting the transaction
WHEN When branch transaction access mode conflicts occur.
Set the correct transaction access mode before starting the transaction
BEGIN READ WRITE; -- or READ ONLY
Why this works
Specify the access mode at transaction start rather than attempting to change it mid-transaction.
Sources
Official documentation ↗
Class 25 — Invalid Transaction State
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev