I believe that the following statement was originally suggested by Tom Lane; I got it from Pavel Stehule's PostgreSQL
Tipspage.
My question is, does this code contain a race hazard, because the list from the SELECT might get changed by another
sessionbefore the DELETE uses it?
delete from del where ctid = any(array(select ctid from del limit 10))
If so, am I correct to think that adding FOR UPDATE to create the version below would eliminate the hazard?
delete from del where ctid = any(array(select ctid from del limit 10 for update))
--
Peter Headland
Architect
Actuate Corporation