names in WHERE and HAVING

From: Zachary Beane <xach(at)xach(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: names in WHERE and HAVING
Date: 2000-12-04 16:49:11
Message-ID: 20001204114911.Y14297@xach.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was reading the docs about SELECT and I came across this:

name

Specifies another name for a column or an expression using the
AS clause. This name is primarily used to label the column for
display. It can also be used to refer to the column's value in
ORDER BY and GROUP BY clauses. But the name cannot be used in
the WHERE or HAVING clauses; write out the expression instead.

What is the reason for this restriction? It would be a great
convenience if it were lifted.

I have several queries against another database system that do
something like this:

select name, count(*) as score
from mytable
group by name
having score > 10

PostgreSQL doesn't like them...

Zach
--
xach(at)xach(dot)com Zachary Beane http://www.xach.com/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2000-12-04 16:52:22 Re: v7.1 Beta?
Previous Message Joel Burton 2000-12-04 16:21:27 Re: Password protection?