No bug in your installation, we're slowly overcoming all of these select distinct statements which are a PG 7.0 thing that didn't show up in PG 6.5. You shouldn't take out the upper() call in the order by, instead you should simply select additional fields to include the same exact things that you're ordering by.
The port is getting there, but there are still some issues :)
-Ben