Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group