Re: Concatenate results of a single column query - Mailing list pgsql-sql

From Greg Stark
Subject Re: Concatenate results of a single column query
Date
Msg-id 87k70c5bel.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Concatenate results of a single column query  (Christoph Haller <ch@rodos.fzk.de>)
List pgsql-sql
Christoph Haller <ch@rodos.fzk.de> writes:

> Interesting feature, but I cannot find function array_append: 
> ERROR:  AggregateCreate: function array_append(integer[], integer) does not exist

It's new in Postgres 7.4

I think you could do this in 7.3 though, it would just be more awkward. Try ||
but I think that's new in 7.4 as well. Otherwise I think you would have to
pick out the upper bound of the array with array_dims and set the upper+1'th
element of the array.

If you're doing text you may want to go directly to a textual concatenation
like:

CREATE FUNCTION concat_agg_accum(text, text) RETURNS text   AS 'select $1 || '', '' || $2'   LANGUAGE sql IMMUTABLE
STRICT;

CREATE AGGREGATE concat_agg (   BASETYPE = text,   SFUNC = concat_agg_accum,   STYPE = text
);


-- 
greg



pgsql-sql by date:

Previous
From: Christoph Haller
Date:
Subject: Re: Concatenate results of a single column query
Next
From: "Stijn Vanroye"
Date:
Subject: Re: three-way join