Say I have:
- T1:
SELECT id FROM x WHERE timestamp < y
(returnsid = [1, 2, 3]
) - T2:
DELETE FROM x WHERE id = 1
- T1:
SELECT timestamp, value FROM x WHERE id = 1
with READ-COMMITTED
isolation.
Does step 3 run the risk of returning an empty result, or does step 1 acquire some sort of lock/snapshot that prevents step 2 from altering the result? (I assume REPEATABLE-READ
will do what I want, but this question is about READ-COMMITTED
).
I am using postgresql, but I am interested in a DB-independent answer. For example, if some databases block the delete while others do not, I'd like to know that. Thank you.