For the sake of clearness, what about using a plain python field to collect all the primary keys? E.g. ```self.primary_keys[v.name] = {}```? Am I missing something? If yes, could you add a comment (in the bug description) describing the motivation for this?