Use temp table when fixing foreign keys only for the same table