Is this example regarding aggregates sourced by subquery correct? - Mailing list pgsql-docs

From David G. Johnston
Subject Is this example regarding aggregates sourced by subquery correct?
Date
Msg-id CAKFQuwbAX=iO9QbpN7_jr+BnUWm9FYX8WbEPUvG0p+nZhp6TZg@mail.gmail.com
Whole thread Raw
Responses Re: Is this example regarding aggregates sourced by subquery correct?
List pgsql-docs

"""
...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.

pgsql-docs by date:

Previous
From: Daniel Gustafsson
Date:
Subject: contrib/intarray programlisting refers to pre-extension file
Next
From: Tom Lane
Date:
Subject: Re: Is this example regarding aggregates sourced by subquery correct?