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