Settings ids in postgres

This PR fixes a problem where non-standard primary keys were causing errors.