| От | Tom Lane |
|---|---|
| Тема | Re: stddev returns 0 when there is one row |
| Дата | |
| Msg-id | 18667.1050974816@sss.pgh.pa.us обсуждение |
| Ответ на | Re: stddev returns 0 when there is one row (nolan@celery.tssi.com) |
| Список | pgsql-general |
nolan@celery.tssi.com writes:
> wouldn't the easiest way to offer both sample and population formulas for
> variance and standard deviation be to just add two new functions,
> varp and stddevp, most of the code for which already exists?
As Joe pointed out, SQL200x seems to have laid down the law already on
what to call these things.
> That way they remain single-input aggregates.
My comment about multiple inputs was in response to the suggestion of
grouped input, which I took to mean that you'd want to write something
like "SELECT STDDEV_GROUPED(value, num_occurrences) FROM foo".
You could hack your way around the problem by defining the aggregate
to take a two-element array type:
SELECT STDDEV_GROUPED(ARRAY[value, num_occurrences]) FROM foo
but this seems ugly and inefficient.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера