Thank you for the clear explanation Dan. I dropped all the constraints on cr_item_publish_audit, but then the trigger procedure started saying "ERROR: Relation 264049 does not exist". Since I had no idea how to fix that, I just gave up and dropped the trigger, and now everything works. I wasn't planning to rely on the auditing stuff anyway so I guess it's okay.