diff options
| author | Tom Lane | 2001-08-14 22:21:59 +0000 |
|---|---|---|
| committer | Tom Lane | 2001-08-14 22:21:59 +0000 |
| commit | 5f7c2bdb537bd18fd7f1cc942950e7e64c6e0a92 (patch) | |
| tree | deb73ae98b59fb4315f82b781a7c22859cbccd00 /src/include/utils | |
| parent | 6f2943b52e9f4af3c4488c0373a3490e38c032a7 (diff) | |
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.
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/builtins.h | 7 | ||||
| -rw-r--r-- | src/include/utils/int8.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index a774309aed8..97efb759c49 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.160 2001/08/13 18:45:36 tgl Exp $ + * $Id: builtins.h,v 1.161 2001/08/14 22:21:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -303,6 +303,8 @@ extern Datum oidlt(PG_FUNCTION_ARGS); extern Datum oidle(PG_FUNCTION_ARGS); extern Datum oidge(PG_FUNCTION_ARGS); extern Datum oidgt(PG_FUNCTION_ARGS); +extern Datum oidlarger(PG_FUNCTION_ARGS); +extern Datum oidsmaller(PG_FUNCTION_ARGS); extern Datum oid_text(PG_FUNCTION_ARGS); extern Datum text_oid(PG_FUNCTION_ARGS); extern Datum oidvectorin(PG_FUNCTION_ARGS); @@ -555,6 +557,9 @@ extern Datum numeric_stddev(PG_FUNCTION_ARGS); extern Datum int2_sum(PG_FUNCTION_ARGS); extern Datum int4_sum(PG_FUNCTION_ARGS); extern Datum int8_sum(PG_FUNCTION_ARGS); +extern Datum int2_avg_accum(PG_FUNCTION_ARGS); +extern Datum int4_avg_accum(PG_FUNCTION_ARGS); +extern Datum int8_avg(PG_FUNCTION_ARGS); /* ri_triggers.c */ extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS); diff --git a/src/include/utils/int8.h b/src/include/utils/int8.h index 2b96d83791b..849b148060a 100644 --- a/src/include/utils/int8.h +++ b/src/include/utils/int8.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: int8.h,v 1.26 2001/06/07 00:09:32 momjian Exp $ + * $Id: int8.h,v 1.27 2001/08/14 22:21:59 tgl Exp $ * * NOTES * These data types are supported on all 64-bit architectures, and may @@ -74,6 +74,7 @@ extern Datum int8div(PG_FUNCTION_ARGS); extern Datum int8abs(PG_FUNCTION_ARGS); extern Datum int8fac(PG_FUNCTION_ARGS); extern Datum int8mod(PG_FUNCTION_ARGS); +extern Datum int8inc(PG_FUNCTION_ARGS); extern Datum int8larger(PG_FUNCTION_ARGS); extern Datum int8smaller(PG_FUNCTION_ARGS); |
