Handled the case where a key is both a primary key and a reference