X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20A91D1B49B for ; Mon, 19 Apr 2004 10:15:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 12710-04 for ; Mon, 19 Apr 2004 10:15:22 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id 17030D1D52E for ; Mon, 19 Apr 2004 10:15:16 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Mon Apr 19 15:15:16 2004 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id PAA09324; Mon, 19 Apr 2004 15:15:15 +0200 (METDST) From: Christoph Haller Message-Id: <200404191315.PAA09557@rodos> Subject: Re: Concatenate results of a single column query To: gsstark@mit.edu (Greg Stark) Date: Mon, 19 Apr 2004 15:15:14 METDST Cc: pgsql-sql@postgresql.org In-Reply-To: <87oepp6v45.fsf@stark.xeocode.com>; from "Greg Stark" at Apr 18, 104 8:06 pm X-Mailer: Elm [revision: 212.4] X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Received' Received: \234by rodos.fzk.de... ^ X-Archive-Number: 200404/159 X-Sequence-Number: 17534 > > > Marco Lazzeri writes: > > > SELECT > > p.name, ARRAY(SELECT nicknames FROM people WHERE people.id = p.id) > > FROM people AS p > > > Any suggestions? > > Something like: > > db=> create aggregate array_aggregate (basetype = integer, sfunc = array_append, stype = integer[], initcond = '{}'); > CREATE AGGREGATE > > db=> select array_aggregate(id) from tab; > array_aggregate > ------------------------------------------------------------------------------------------------------------------------------------------------------------ > {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,27,26,44,45,46,47,48,49,50,51,52,53,54,35} > (1 row) > > -- > greg > > Interesting feature, but I cannot find function array_append: ERROR: AggregateCreate: function array_append(integer[], integer) does not exist TIA Regards, Christoph