WHERE on an alias - Mailing list pgsql-sql

From Joseph Shraibman
Subject WHERE on an alias
Date
Msg-id 3B8698E7.4080106@selectacast.net
Whole thread Raw
Responses Re: WHERE on an alias
Re: WHERE on an alias
Re: WHERE on an alias
List pgsql-sql
playpen=# select a, sum(b) as dsum from taba where dsum > 5 group by(a);
ERROR:  Attribute 'dsum' not found

Why can we GROUP BY on an alias but not do a WHERE on an alias?  I have a subselect that 
explain shows is being run twice if I have to put it in the WHERE clause.

-- 
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com



pgsql-sql by date:

Previous
From: Vivek Khera
Date:
Subject: Re: DBD::Pg install error (freebsd)
Next
From: Joseph Shraibman
Date:
Subject: Re: WHERE on an alias