The data-change violation and the problem that you're seeing here are both related to problems with referential integrity triggers in pg. In this particular case, I think content_item__delete can be rewritten. There really is no need to update live_revision and latest_revision when deleting the content_item, so I think that another function, that avoids this problem, can be written to delete the content revisions. I'll give it a shot and let you know if I get something that works.