Re: merge result sets

From: simon <simon(dot)litwan(at)wyona(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: merge result sets
Date: 2006-06-21 12:08:29
Message-ID: 1150891709.9156.11.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mit, 2006-06-21 at 12:34 +0200, Martijn van Oosterhout wrote:
> On Wed, Jun 21, 2006 at 12:23:44PM +0200, simon wrote:
> > or in other words, i just would like to know how to rewrite
> >
> > SET kategorie = array_to_string ((SELECT ARRAY (SELECT
> > kategorie_bezeichnung
> >
> > so it works in psql7.3 as well.
>
> The aggregate stuff should work. something like:
>
> SET kategorie = (SELECT comma_aggregate(kategorie_bezeichnung) FROM ...)
>
> should do the trick.
i just found

CREATE FUNCTION comma_aggregate(text,text) RETURNS text AS ' SELECT CASE
WHEN $1 <> '''' THEN $1 || '', '' || $2 ELSE $2 END; ' LANGUAGE sql
IMMUTABLE STRICT; CREATE AGGREGATE comma (basetype=text,
sfunc=comma_aggregate, stype=text, initcond='' );

and this didn't work with the above mentioned querry.

i actually never found any docu about how tor write custom function
which takes a whole result set no matter how many rows.

thanks anyway
simon

>
> Have a nice day,
--
Simon Litwan simon(dot)litwan(at)wyona(dot)com
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kenneth Downs 2006-06-21 12:10:20 Re: minimizing downtime when upgrading
Previous Message Peter Eisentraut 2006-06-21 11:21:11 Re: [GENERAL] [ppa][PATCHES] Argument handling improvements