"""
...This ordering is unspecified by default, but can be controlled by writing an ORDER BY clause within the aggregate call, as shown in Section 4.2.7. Alternatively, supplying the input values from a sorted subquery will usually work. For example:
SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
But this syntax is not allowed in the SQL standard, and is not portable to other database systems.
"""
This seems incorrect - I was expecting something like:
SELECT xmlagg((SELECT x FROM test ORDER BY y DESC))
The example seems expressly permitted by the standard and other database systems.
I'll believe that said ordering in the example is not guaranteed but that isn't what it says.
David J.