From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "pgsql-docs(at)postgresql(dot)org" <pgsql-docs(at)postgresql(dot)org> |
Subject: | Is this example regarding aggregates sourced by subquery correct? |
Date: | 2016-05-20 20:08:27 |
Message-ID: | CAKFQuwbAX=iO9QbpN7_jr+BnUWm9FYX8WbEPUvG0p+nZhp6TZg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
http://www.postgresql.org/docs/9.5/static/functions-aggregate.html
"""
...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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-05-20 21:07:28 | Re: Is this example regarding aggregates sourced by subquery correct? |
Previous Message | Daniel Gustafsson | 2016-05-17 09:01:47 | contrib/intarray programlisting refers to pre-extension file |