Re: avg() of array values

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: avg() of array values
Дата
Msg-id 20070911160324.GC29496@svana.org
обсуждение исходный текст
Ответ на avg() of array values  (Alban Hertroys <alban@magproductions.nl>)
Ответы Re: avg() of array values  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
On Tue, Sep 11, 2007 at 05:50:38PM +0200, Alban Hertroys wrote:
> *> select avg(*) from explode_array(array[1, 3]);
>           avg
> ------------------------
>  1.00000000000000000000
> (1 row)

avg(*) is not valid, same for sum(*) the reaosn you get the answer you
do it because postgres replaces the * with a 1, whic doesn't change the
fact that the query is wrong.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: "Dmitry Koterov"
Дата:
Сообщение: Sthange things happen: SkyTools pgbouncer is NOT a balancer
Следующее
От: "Rodrigo De León"
Дата:
Сообщение: Re: Question about a query with two count fields