Fix query for Primary Key retrieval.