gzoller@hotmail.com (Greg Zoller) writes:
> My problem is this: what happens if half-way through this set of
> operations someone else (perhaps in another thread) attempts to execute
> the same operation?
See
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/mvcc.html
SELECT FOR UPDATE and/or the implicit row lock done by UPDATE should
solve your problem.
regards, tom lane