orokusaki
orokusaki

Reputation: 57198

Can a locked row [in Postgres] still be read from?

If I SELECT... FOR UPDATE a row in a transaction, it will obviously block the row from being written to, but will it disallow reads as well? I'd prefer to still be able to read from the row, so if the answer is yes, can you provide a solution to work this?

Upvotes: 12

Views: 13879

Answers (1)

Richard Huxton
Richard Huxton

Reputation: 22972

You can read just fine. There are lock modes that prevent reading but this isn't one of them.

http://www.postgresql.org/docs/current/static/explicit-locking.html

Upvotes: 15

Related Questions