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

Re: PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working on UNION query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Eade <seade(at)backstagetech(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working on UNION query
Date: 2004-10-29 19:22:01
Message-ID: 19602.1099077721@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Scott Eade <seade(at)backstagetech(dot)com(dot)au> writes:
> SELECT TURBINE_USER.USER_ID FROM TURBINE_USER WHERE TURBINE_USER.USER_ID = 1
> UNION
> SELECT TURBINE_USER.USER_ID FROM TURBINE_USER WHERE TURBINE_USER.USER_ID = 2
> -- The following works.
> --ORDER BY 1 ASC
> -- The following does not work when I would perhaps expect it to (it 
> certainly works when a non-UNION query is used).
> ORDER BY TURBINE_USER.USER_ID ASC

This isn't a bug.  The output columns of the UNION don't belong to any
particular table anymore; they can only be referenced by column number
or unqualified column name.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2004-10-29 21:06:22
Subject: Re: BUG #1301: pg_restore failed on AMD 64bit machine
Previous:From: Tom LaneDate: 2004-10-29 19:20:10
Subject: Re: copy command PANIC in --encoding='utf8' createdb option

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