Postgres Error Aggregate Functions Postgresql Create Index