I believe that the following statement was originally suggested by Tom Lane; I 
got it from Pavel Stehule's PostgreSQL Tips page.
My question is, does this code contain a race hazard, because the list from the 
SELECT might get changed by another session before 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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to