"PostgreSQL Bugs List" <[EMAIL PROTECTED]> writes:
>  The query:
> SELECT id, lang as name, (SELECT lang FROM participants WHERE id = 
> event.participant) as pname FROM event ORDER BY name || pname; 
>  returns an error:
> ERROR: column "name" does not exist

It's not a bug.  Per
http://www.postgresql.org/docs/7.4/static/sql-select.html
under "ORDER BY Clause"

: expression can be the name or ordinal number of an output column (SELECT
: list item), or it can be an arbitrary expression formed from
: input-column values.

The ability to reference an output column in ORDER BY is actually a legacy
feature that was removed in the SQL99 spec.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to