Re: Set Returning Functions and array_agg()

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Set Returning Functions and array_agg()
Дата
Msg-id klb153$iuj$1@gonzo.reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Set Returning Functions and array_agg()  (Stephen Scheck <singularsyntax@gmail.com>)
Список pgsql-general
On 2013-04-24, Stephen Scheck <singularsyntax@gmail.com> wrote:
> --f46d043c810aa794a404db21f464
> Content-Type: text/plain; charset=ISO-8859-1
>
> Possibly due to my lack of thorough SQL understanding. Perhaps there's a
> better way of doing what I'm ultimately trying to accomplish, but still the
> question remains - why does this work:
>
> pg_dev=# select unnest(array[1,2,3]);
>  unnest
> --------
>       1
>       2
>       3
> (3 rows)
>
> But not this:
>
> pg_dev=# select array_agg(unnest(array[1,2,3]));
> ERROR:  set-valued function called in context that cannot accept a set

the parser doesn't understand it for the reason given

same as it doesn't understand this.

 select avg(generate_series(1,3));

but it does understand this:

 select avg(a) from  generate_series(1,3) as s(a);

and this:

 select array_agg(i) from unnest(array[1,2,3])) as u(i);




--
⚂⚃ 100% natural

В списке pgsql-general по дате отправления:

Предыдущее
От: jesse.waters@gmail.com
Дата:
Сообщение: Re: pgdump error "Could not open file pg_clog/0B8E: No such file or directory"
Следующее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: custom session variables?