BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work - Mailing list pgsql-bugs

From PostgreSQL Bugs List
Subject BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work
Date
Msg-id 20040922143113.0341A5A1048@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1265
Logged by:          Ansis

Email address:      ataols@latnet.lv

PostgreSQL version: 7.4.2

Operating system:   Gentoo Linux

Description:        sorting by (ORDER BY) result of an operation for names
assigned by AS does not work

Details:

 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

 However, "ORDER BY name" works, "ORDER BY name, pname" works etc. Also, if
I use original column names, not assigned ones, it works with cncatenation
operator too. So, the error occurs only then assigned names are used inside
operator - the Postgre does not find this name.
 It looks like a bug - and an easy fixable one.

pgsql-bugs by date:

Previous
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1264: Jimminy Cricket
Next
From: Tom Lane
Date:
Subject: Re: BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work