Lock and transaction in postgres that should block a query
问题 Let's assume in SQL window 1 I do: -- query 1 BEGIN TRANSACTION; UPDATE post SET title = 'edited' WHERE id = 1; -- note that there is no explicit commit Then from another window (window 2) I do: -- query 2 SELECT * FROM post WHERE id = 1; I get: 1 | original title Which is fine as the default isolation level is READ COMMITTED and because query 1 is never committed, the change it performs is not readable until I explicitly commit from window 1. In fact if I, in window 1, do: COMMIT TRANSACTION