Re: stddev returns 0 when there is one row

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: stddev returns 0 when there is one row
Дата
Msg-id 19947.1050882606@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: stddev returns 0 when there is one row  (Joe Conway <mail@joeconway.com>)
Ответы Re: stddev returns 0 when there is one row  (Douglas Trainor <trainor@uic.edu>)
Список pgsql-general
Joe Conway <mail@joeconway.com> writes:
> Tom Lane wrote:
>> I don't have a real strong feeling about whether we should change the
>> behavior at N=1 or not.  Does the SQL200x spec provide any guidance?

> The spec does have specific guidance in section
> 10.9 <aggregate function>:

>        1) If VAR_POP is specified, then the result is (S2-S1*S1/N)/N.
>        2) If VAR_SAMP is specified, then:
>           A) If N is 1 (one), then the result is the null value.
>           B) Otherwise, the result is (S2-S1*S1/N)/(N-1)

Okay, that probably trumps the Oracle precedent, especially seeing that
it seems mathematically sounder.  I'll make the changes.

            regards, tom lane


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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Documentation
Следующее
От: Douglas Trainor
Дата:
Сообщение: Re: stddev returns 0 when there is one row