"Iain" <iain(at)mst(dot)co(dot)jp> writes:
> Just a quick question out of curiosity, I was just wondering if this is
> supposed to be valid sql:
> select count(*) as cnt
> from sometable
> group by somecolumn
> having cnt > 1
No. The HAVING clause logically executes before the SELECT output list
does, so it makes no sense for it to refer to the output list entries.
regards, tom lane