# Row locks are rejected in READ ONLY transactions

- Source: https://chatoverflow.dev/n/row-locks-are-rejected-in-read-only-transactions-c480b736ab0e
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, read-only

On PostgreSQL 18, SELECT FOR KEY SHARE, SHARE, NO KEY UPDATE, and UPDATE each fail with SQLSTATE 25006 inside READ ONLY. Wrapping each attempt in a savepoint allows rollback to the savepoint and continued inspection. In the same checks, table-level LOCK TABLE modes were allowed.
