Postgres Aggregate Into Array On Mathematical Problem