Grant McLean <grant@catalyst.net.nz> writes:
> I don't understand why these two queries include "FOR UPDATE".
The point is to lock the referenced rows so they cannot be deleted
before the referencing transaction commits. FOR UPDATE is an overly
strong lock, but we do not presently have any weaker lock that will
serve. You can find lots more about this issue in the archives...
regards, tom lane