I renamed the new element to DumpableObject from "proargs" to the more general name "sortkey".
This way this element can be used by any object types in the future,
which might require sorting by additional information than type, namespace and name.
Currently, it's only set for functions/aggregates though, its NULL for all other object types.
I felt less ugly to add a new element with a general name than one specific for functions.
I also moved the check to the last part of DOTypeNameCompare, just before sorting by OIDs as a last resort.
Feedback on the implementation is welcomed.
If this can be achieved without adding a new element to DumpableObject,
it is of course much better, but I couldn't find a way of doing that.