Josh Berkus <josh(at)agliodbs(dot)com> writes:
>> ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
>> the result columns
> I do believe that this is per the SQL spec; UNIONs may only be sorted on the
> output columns.
Right. We extend the SQL spec for ORDER BY on simple selects, but we
have not gotten around to doing so for ORDER BY on set-operation
results. You can only sort by unadorned output columns.
Patches to improve this are welcome ;-)
regards, tom lane