pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Ram Nathaniel <ram_nathaniel@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL syntax extentions - to put postgres ahead in the race
Date: Fri, 06 Aug 2004 03:07:27 -0400
Message-ID: <8583.1091776047@sss.pgh.pa.us> (raw)
In-Reply-To: <20040805220147.O92438@megazone.bigpanda.com>
References: <BAY7-DAV12V0KUvkRkZ000f7e18@hotmail.com>
	<20040805220147.O92438@megazone.bigpanda.com>

Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> On Thu, 5 Aug 2004, Ram Nathaniel wrote:
>> 2) aggregated concatenation:

> Theoretically, you should be able to do this right now in PostgreSQL with
> user defined aggregates (although you can't pass a second argument
> currently for the separator).

There's nothing particularly stopping us from supporting
multiple-argument aggregates, except a lack of round tuits.
(I suppose we'd want to rethink the syntax of CREATE AGGREGATE,
but otherwise it ought to be pretty straightforward.)

> I believe that an ordered subquery in FROM
> will currently allow you to get an ordered aggregate, or perhaps you'd
> have to turn off hash aggregation, but I think you should be able to get
> it to keep the ordering.

I think you would want to ORDER BY twice:

    SELECT class, list(student) from
	(select class, student from grades order by class, student) ss
    order by class;

It looks like (at least in CVS tip) planner.c will take into account the
relative costs of doing a GroupAgg vs doing a HashAgg and re-sorting,
but I'm too tired to try it right now...

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <8583.1091776047@sss.pgh.pa.us>
Permalink:  ../8583.1091776047@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8583.1091776047@sss.pgh.pa.us

 · 

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: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sszabo@megazone.bigpanda.com, ram_nathaniel@hotmail.com
  Subject: Re: SQL syntax extentions - to put postgres ahead in the race
  In-Reply-To: <8583.1091776047@sss.pgh.pa.us>

* 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