On Wed, 7 Jul 2004, Peter Eisentraut wrote:
> Am Mittwoch, 7. Juli 2004 14:58 schrieb PostgreSQL Bugs List:
> > Description: evaluation order of select seems to be wrong
>
> Please read this:
> http://www.postgresql.org/docs/7.4/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL
The issue is that from what he said the standard may mandate that HAVING
is applied before the select list is evaluated because it's part of the
table expression. In that case, the statement he gave would be required
to work because the select list would be evaluated on the output of the
table expression that's already had the having clause filter out the bad
rows. This is different from the case where both are in where conditions.