From 0ebf1cc83465a4058c172d74c823cce0bebe0e11 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Fri, 10 Mar 2006 20:15:28 +0000 Subject: Implement 4 new aggregate functions from SQL2003. Specifically: var_pop(), var_samp(), stddev_pop(), and stddev_samp(). var_samp() and stddev_samp() are just renamings of the historical Postgres aggregates variance() and stddev() -- the latter names have been kept for backward compatibility. This patch includes updates for the documentation and regression tests. The catversion has been bumped. NB: SQL2003 requires that DISTINCT not be specified for any of these aggregates. Per discussion on -patches, I have NOT implemented this restriction: if the user asks for stddev(DISTINCT x), presumably they know what they are doing. --- doc/src/sgml/func.sgml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 7aba2c7d145..f7adaab009b 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -7914,6 +7914,46 @@ SELECT NULLIF(value, '(none)') ... double precision for floating-point arguments, otherwise numeric + historical alias for stddev_samp + + + + + + standard deviation + population + + stddev_pop(expression) + + + smallint, int, + bigint, real, double + precision, or numeric + + + double precision for floating-point arguments, + otherwise numeric + + population standard deviation of the input values + + + + + + standard deviation + sample + + stddev_samp(expression) + + + smallint, int, + bigint, real, double + precision, or numeric + + + double precision for floating-point arguments, + otherwise numeric + sample standard deviation of the input values @@ -7951,9 +7991,48 @@ SELECT NULLIF(value, '(none)') ... double precision for floating-point arguments, otherwise numeric - sample variance of the input values (square of the sample standard deviation) + historical alias for var_samp + + + + variance + population + + var_pop(expression) + + + smallint, int, + bigint, real, double + precision, or numeric + + + double precision for floating-point arguments, + otherwise numeric + + population variance of the input values (square of the population standard deviation) + + + + + + variance + sample + + var_samp(expression) + + + smallint, int, + bigint, real, double + precision, or numeric + + + double precision for floating-point arguments, + otherwise numeric + + sample variance of the input values (square of the sample standard deviation) + -- cgit v1.2.3