Make sure query_chain only runs on a relation