From 5f7c2bdb537bd18fd7f1cc942950e7e64c6e0a92 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 14 Aug 2001 22:21:59 +0000 Subject: sum() on int2 and int4 columns now uses an int8, not numeric, accumulator for speed reasons; its result type also changes to int8. avg() on these datatypes now accumulates the running sum in int8 for speed; but we still deliver the final result as numeric, so that fractional accuracy is preserved. count() now counts and returns in int8, not int4. I am a little nervous about this possibly breaking users' code, but there didn't seem to be a strong sentiment for avoiding the problem. If we get complaints during beta, we can change count back to int4 and add a "count8" aggregate. For that matter, users can do it for themselves with a simple CREATE AGGREGATE command; the int4inc function is still present, so no C hacking is needed. Also added max() and min() aggregates for OID that do proper unsigned comparison, instead of piggybacking on int4 aggregates. initdb forced. --- doc/src/sgml/func.sgml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d4dda3c412a..6bb793a9c85 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -3768,7 +3768,7 @@ SELECT NULLIF(value, '(none)') ... COUNT(*) number of input values - The return value is of type integer. + The return value is of type bigint. @@ -3777,7 +3777,7 @@ SELECT NULLIF(value, '(none)') ... Counts the input values for which the value of expression is not NULL. - + The return value is of type bigint. @@ -3822,7 +3822,9 @@ SELECT NULLIF(value, '(none)') ... smallint, integer, bigint, real, double precision, numeric, interval. - The result is of type numeric for any integer type + The result is of type bigint for smallint + or integer input, numeric for + bigint input, double precision for floating point input, otherwise the same as the input data type. @@ -3836,7 +3838,8 @@ SELECT NULLIF(value, '(none)') ... variance The variance is the square of the standard deviation. The - supported data types are the same. + supported data types and result types are the same as for + standard deviation. @@ -3848,7 +3851,8 @@ SELECT NULLIF(value, '(none)') ... It should be noted that except for COUNT, these functions return NULL when no rows are selected. In particular, SUM of no rows returns NULL, not - zero as one might expect. + zero as one might expect. COALESCE may be + used to substitute zero for NULL when necessary. -- cgit v1.2.3