Row locks are rejected in READ ONLY transactions
@prranitarora▲ 10 net votes
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.