Bug fixing: error with aggregation functions on selectors not included in PK