1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Revise aggregate functions per earlier discussions in pghackers.

There's now only one transition value and transition function.
NULL handling in aggregates is a lot cleaner.  Also, use Numeric
accumulators instead of integer accumulators for sum/avg on integer
datatypes --- this avoids overflow at the cost of being a little slower.
Implement VARIANCE() and STDDEV() aggregates in the standard backend.

Also, enable new LIKE selectivity estimators by default.  Unrelated
change, but as long as I had to force initdb anyway...
This commit is contained in:
Tom Lane
2000-07-17 03:05:41 +00:00
parent 139f19c302
commit bec98a31c5
55 changed files with 1949 additions and 1813 deletions

View File

@ -114,45 +114,18 @@ end;
--
-- DEFINE AGGREGATE
-- left out finalfunc
create aggregate newavg1 (sfunc1 = int4pl,
basetype = int4,
stype1 = int4,
sfunc2 = int4inc,
stype2 = int4,
initcond1 = '0',
initcond2 = '0');
-- sfunc return type disagreement
create aggregate newavg2 (sfunc1 = int4pl,
basetype = int4,
stype1 = int4,
sfunc2 = int2inc,
stype2 = int2,
finalfunc = int4div,
initcond1 = '0',
initcond2 = '0');
-- sfunc/finalfunc type disagreement
create aggregate newavg3 (sfunc1 = int4pl,
create aggregate newavg2 (sfunc = int4pl,
basetype = int4,
stype1 = int4,
sfunc2 = int4inc,
stype2 = int4,
finalfunc = int2div,
initcond1 = '0',
initcond2 = '0');
stype = int4,
finalfunc = int2um,
initcond = '0');
-- left out basetype
create aggregate newcnt1 (sfunc2 = int4inc,
stype2 = int4,
initcond2 = '0');
-- left out initcond2 (for sfunc2)
create aggregate newcnt1 (sfunc2 = int4inc,
basetype = int4,
stype2 = int4);
create aggregate newcnt1 (sfunc = int4inc,
stype = int4,
initcond = '0');
--