Re: Concatenate results of a single column query

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Concatenate results of a single column query
Дата
Msg-id 87k70c5bel.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Concatenate results of a single column query  (Christoph Haller <ch@rodos.fzk.de>)
Список 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 по дате отправления:

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Concatenate results of a single column query
Следующее
От: "Stijn Vanroye"
Дата:
Сообщение: Re: three-way join