Add error messages for edge cases in relation queries.

Also allow _ids to be queried on a relation.