Implement 4 new aggregate functions from SQL2003. Specifically: var_pop(),
Neil Conway <neilc@samurai.com>
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.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +81 −2 |
| src/backend/utils/adt/float.c | modified | +68 −10 |
| src/backend/utils/adt/numeric.c | modified | +83 −74 |
| src/include/catalog/catversion.h | modified | +2 −2 |
| src/include/catalog/pg_aggregate.h | modified | +48 −16 |
| src/include/catalog/pg_proc.h | modified | +45 −9 |
| src/include/utils/builtins.h | modified | +9 −5 |
| src/test/regress/expected/aggregates.out | modified | +62 −0 |
| src/test/regress/sql/aggregates.sql | modified | +14 −10 |