Postgres Aggregate Functions Not A Function Mapping