Changed to pg gem
Changed config to postgres
Fixed group by for Postgres dialect