Postgres Aggregate Functions In Where Clause Is Ambiguous