Re: aggregate functions

From: Holger Klawitter <holger(at)klawitter(dot)de>
To: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: aggregate functions
Date: 2000-06-19 10:31:19
Message-ID: 394DF677.92966CD3@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> is there any easy way to add the string concatenation operator
> as a collating operator? I would like to do something like:

Blimey, I should have looked for "create aggregate".
But to those interested here is my solution.

create function
joinfunc( text, text )
returns text as '
begin
if $1 = '''' then
return $2;
else
return ( $1 || '', '' ) || $2;
end if;
end;
' language 'plpgsql';

create aggregate join (
basetype = text,
sfunc1 = joinfunc,
stype1 = text,
initcond1 = ''
);

Perhaps someone want to put that into the documentation.
By the way, there is still one problem:

select join(col) group by ...
does not work, one has to type
select "join"(col) group by ...

I assume this is bug ...

Regards,
Holger Klawitter
--
Holger Klawitter +49 (0)251 484 0637
holger(at)klawitter(dot)de http://www.klawitter.de/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Brothers 2000-06-19 12:09:42 Re: Backend died while dropping index
Previous Message NRonayette 2000-06-19 08:52:20 A Query on PG_ tables