Mark Harrison <mh@pixar.com> writes:
> It would be really great if I could handle this without the front end
> program, so that multiple programs could do something like the following:
> select next image to be processed (with above select logic)
> process the image
> delete the row for that image
> I think that I can use "select for update" to obtain a write lock (so that
> I can safely delete the row when finished), but I'm unsure if it's possible
> to avoid the race condition where two processes would get the same row.
See the archives; this has been discussed in great detail before
(several times before, if memory serves).
regards, tom lane