Fix #452

I made PK-related query methods throw an exception. Is it relevant or should we just remove them from the generated code?