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

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work
Date: 2004-09-22 14:31:13
Message-ID: 20040922143113.0341A5A1048@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1265
Logged by: Ansis

Email address: ataols(at)latnet(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-09-22 15:04:34 Re: BUG #1265: sorting by (ORDER BY) result of an operation for names assigned by AS does not work
Previous Message Markus Feier 2004-09-22 09:01:50 VIEWS