On Wed, Nov 25, 2009 at 20:35, Tom Lane <tgl@sss.pgh.pa.us> wrote:
[...]
> HAVING is not included because (a) it wasn't historically, and (b)
> the use-case for a bare column alias in HAVING would be pretty small
> anyway. Your example wouldn't work even if HAVING acted the same
> as GROUP BY/ORDER BY, since you didn't just write the alias but
> tried to compare it to something else.
Thank you for the explanation. I didn't fully understand the gory
details, but it's of use to know that I cannot refer to an alias.
--
- Rikard