>> This puzzles me, although I'm uncertain whether I'm puzzled by upper(2)
>> not working with UNION or puzzled by upper(2) working without UNION.
>
> That is to be expected. Ordering by UPPER(2) does not sort by the second
> column, but it will do the following:
> => Coerce 2 to "2",
> => Execute UPPER("2") which results in "2".
Thanks, Mark, for clearing up my confusion. Of course UPPER takes [VAR]CHAR as
input and not column position. My human brain was all too easily confused and
complicated reasoning overlooked this very simple fact.
Set