check for primary key in calculate_joins