Added SUM aggregate function for relations.