X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 303AF5E4075 for ; Fri, 6 Aug 2004 04:07:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75848-10 for ; Fri, 6 Aug 2004 07:07:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 739FB5E407C for ; Fri, 6 Aug 2004 04:07:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7677RvF008584; Fri, 6 Aug 2004 03:07:28 -0400 (EDT) To: Stephan Szabo Cc: Ram Nathaniel , pgsql-sql@postgresql.org Subject: Re: SQL syntax extentions - to put postgres ahead in the race In-reply-to: <20040805220147.O92438@megazone.bigpanda.com> References: <20040805220147.O92438@megazone.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Thu, 05 Aug 2004 22:22:33 -0700" Date: Fri, 06 Aug 2004 03:07:27 -0400 Message-ID: <8583.1091776047@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/36 X-Sequence-Number: 18533 Stephan Szabo 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