From: Julian Scarfe <julian@avbrief.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Ordering in an aggregate -- points to paths
Date: Sun, 15 Jun 2003 17:48:40 +0100
Message-ID: <039401c3335d$f94d1760$0600a8c0@Wilbur> (raw)
References: <036301c33350$a4bd5e60$0600a8c0@Wilbur>
<13056.1055692197@sss.pgh.pa.us>
From: "Tom Lane" <tgl@sss.pgh.pa.us>
> Yeah, this is a fairly obvious thing to want to do with a user-written
> aggregate. It does not work in released versions, because the planner
> does not notice that the inner SELECT's output ordering matches what
> the GROUP BY needs, and so it inserts an additional Sort plan step
> above the sub-select (you can see this if you look at EXPLAIN output).
> Unfortunately, on most platforms qsort() isn't stable and will not
> preserve the ordering of its input for equal keys. So you lose the
> minor ordering by seq_no in the re-sort.
Most grateful for the rapid response Tom. Knowing that, I can work around by
iterating through the firs at the application level.
Regards
Julian Scarfe
PS: you shouldn't be working on a Sunday, it's bad for you ;-)
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: pgsql-sql@postgresql.org
Cc: julian@avbrief.com, tgl@sss.pgh.pa.us
Subject: Re: Ordering in an aggregate -- points to paths
In-Reply-To: <039401c3335d$f94d1760$0600a8c0@Wilbur>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox