Provide moving-aggregate support for a bunch of numerical aggregates.
Tom Lane <tgl@sss.pgh.pa.us>
Provide moving-aggregate support for a bunch of numerical aggregates. First installment of the promised moving-aggregate support in built-in aggregates: count(), sum(), avg(), stddev() and variance() for assorted datatypes, though not for float4/float8. In passing, remove a 2001-vintage kluge in interval_accum(): interval array elements have been properly aligned since around 2003, but nobody remembered to take out this workaround. Also, fix a thinko in the opr_sanity tests for moving-aggregate catalog entries. David Rowley and Florian Pflug, reviewed by Dean Rasheed
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/int8.c | modified | +57 −6 |
| src/backend/utils/adt/numeric.c | modified | +334 −45 |
| src/backend/utils/adt/timestamp.c | modified | +47 −25 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_aggregate.h | modified | +133 −133 |
| src/include/catalog/pg_proc.h | modified | +20 −0 |
| src/include/utils/builtins.h | modified | +7 −0 |
| src/include/utils/int8.h | modified | +2 −0 |
| src/include/utils/timestamp.h | modified | +1 −0 |
| src/test/regress/expected/opr_sanity.out | modified | +6 −6 |
| src/test/regress/expected/window.out | modified | +475 −0 |
| src/test/regress/sql/opr_sanity.sql | modified | +6 −6 |
| src/test/regress/sql/window.sql | modified | +141 −0 |