Add GROUP BY to avoid Postgres error
Merge branch 'bugfix-postgres-2' into openpa

* bugfix-postgres-2:
  Add GROUP BY to avoid Postgres error