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

From Tom Lane
Subject Re: PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working on UNION query
Date
Msg-id 19602.1099077721@sss.pgh.pa.us
Whole thread Raw
In response to PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working on UNION query  (Scott Eade <seade@backstagetech.com.au>)
List pgsql-bugs
Scott Eade <seade@backstagetech.com.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: copy command PANIC in --encoding='utf8' createdb option
Next
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1301: pg_restore failed on AMD 64bit machine