I think the problem is with the foreign-key reference. Does the callinguser have permission to do SELECT FOR UPDATE on the referenced table?
regards, tom lane