Factor out subselect from add_relations_list