Group by columns must appear in select

This fixed the requirement for postgresql to have all group by columns in the select.