Let's say I have something like this:
select sum(points) as total_points
where total_points > 25
group by username
ERROR: column "total_points" does not exist
I believe PostgreSQL is like other brands of sql, where you need to do:
SELECT t.* FROM ( SELECT SUM(points) AS total_points FROM sometable GROUP BY username ) t WHERE total_points > 25
EDIT: Forgot to alias subquery.