Delegate primary_key to superclass when necessary, otherwise default; added testing