That was probably done deliberately, back in the day when constraints tended to have uselessly random names like "$1" --- sorting by the constraint text was more helpful. I agree that now sorting by name seems like the better thing.
Even in the "$x" case, it's better to have them sorted in that order (ie. the order they were created...)
I think there's nothing wrong with the "ORDER BY 1" part ... it's the fact that the columns are selected in a different order than they'll be used that seems bizarre to me. I fixed it like this instead.
Ah, the way that requires effort :) ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend