public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: [email protected] <[email protected]>
Subject: Is this example regarding aggregates sourced by subquery correct?
Date: Fri, 20 May 2016 16:08:27 -0400
Message-ID: <CAKFQuwbAX=iO9QbpN7_jr+BnUWm9FYX8WbEPUvG0p+nZhp6TZg@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-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.
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Is this example regarding aggregates sourced by subquery correct?
In-Reply-To: <CAKFQuwbAX=iO9QbpN7_jr+BnUWm9FYX8WbEPUvG0p+nZhp6TZg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox