Re: aggregate function

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: aggregate function
Date: 2003-09-05 23:37:40
Message-ID: 87k78m958b.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Claudio Lapidus" <clapidus(at)hotmail(dot)com> writes:

> Hello
>
> I would like to know how can I define/create a new aggregate function. I
> need a custom function that operate on a set of text strings and return a
> certain string aggregate based on certain rules. But I cannot figure out how
> can I define such a data set to operate on.

Is this example helpful?

create function concat_agg_accum(varchar, varchar) returns varchar
as 'select $1 || '', '' || $2'
language sql
strict immutable;

create aggregate concat_agg (
basetype = varchar,
stype = varchar,
sfunc = concat_agg_accum
);

--
greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2003-09-06 00:03:34 Re: tsearch2 and unexpected exists
Previous Message Tom Lane 2003-09-05 21:52:55 Re: [PERFORM] Seq scan of table?