Re: aggregate function - Mailing list pgsql-general

From Greg Stark
Subject Re: aggregate function
Date
Msg-id 87k78m958b.fsf@stark.dyndns.tv
Whole thread Raw
In response to aggregate function  ("Claudio Lapidus" <clapidus@hotmail.com>)
List pgsql-general
"Claudio Lapidus" <clapidus@hotmail.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PERFORM] Seq scan of table?
Next
From: "Nigel J. Andrews"
Date:
Subject: Re: tsearch2 and unexpected exists