Re: reference to 'as' field - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: reference to 'as' field
Date
Msg-id 20050901180041.GA42660@winnie.fuhr.org
Whole thread Raw
In response to reference to 'as' field  (Frank Bax <fbax@sympatico.ca>)
List pgsql-novice
On Thu, Sep 01, 2005 at 11:11:59AM -0400, Frank Bax wrote:
>
> When I use "select (f1+f2+f3+f4+f5) as f0 ..." in 7.4.3, it seems I can use
> "f0" is "order by", but not "where" clause [column 'f0' does not
> exist]?  Does this change in more current versions?  Is there a list of
> which clauses support this syntax in which versions?

Here's an excerpt from the SELECT documentation for 8.0 (8.1beta
says the same thing):

"Using the clause AS output_name, another name can be specified for
an output column.  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 not in the WHERE or HAVING
clauses; there you must write out the expression instead."

http://www.postgresql.org/docs/8.0/static/sql-select.html

--
Michael Fuhr

pgsql-novice by date:

Previous
From: Nabil Sayegh
Date:
Subject: remembering multiple currval() inside a RULE
Next
From:
Date:
Subject: Linux File Systems and Postgres (or dbs in general)