add function diff_with_primary_key