mirror of
https://github.com/postgres/postgres.git
synced 2026-06-03 06:18:35 -04:00
bec98a31c5
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...
24 lines
496 B
SQL
24 lines
496 B
SQL
--
|
|
-- CREATE_AGGREGATE
|
|
--
|
|
|
|
-- all functions CREATEd
|
|
CREATE AGGREGATE newavg (
|
|
sfunc = int4_accum, basetype = int4, stype = _numeric,
|
|
finalfunc = numeric_avg,
|
|
initcond1 = '{0,0,0}'
|
|
);
|
|
|
|
-- without finalfunc; test obsolete spellings 'sfunc1' etc
|
|
CREATE AGGREGATE newsum (
|
|
sfunc1 = int4pl, basetype = int4, stype1 = int4,
|
|
initcond1 = '0'
|
|
);
|
|
|
|
-- value-independent transition function
|
|
CREATE AGGREGATE newcnt (
|
|
sfunc = int4inc, basetype = 'any', stype = int4,
|
|
initcond = '0'
|
|
);
|
|
|