fixing PostgreSQL on heroku. try including id with aggregate function in the select query