This is related to a known referential integrity bug in postgresql. Vinod has been following up on this, but I don't think we have heard anything back yet? I'm going to take a look at this, and see if I can rewrite it to avoid the pg bug until we can get a fix.