4 -- all functions CREATEd
5 CREATE AGGREGATE newavg (
6 sfunc = int4_avg_accum, basetype = int4, stype = _int8,
11 COMMENT ON AGGREGATE newavg_wrong (int4) IS 'an agg comment';
12 ERROR: aggregate newavg_wrong(integer) does not exist
13 COMMENT ON AGGREGATE newavg (int4) IS 'an agg comment';
14 COMMENT ON AGGREGATE newavg (int4) IS NULL;
15 -- without finalfunc; test obsolete spellings 'sfunc1' etc
16 CREATE AGGREGATE newsum (
17 sfunc1 = int4pl, basetype = int4, stype1 = int4,
20 -- zero-argument aggregate
21 CREATE AGGREGATE newcnt (*) (
22 sfunc = int8inc, stype = int8,
25 -- old-style spelling of same
26 CREATE AGGREGATE oldcnt (
27 sfunc = int8inc, basetype = 'ANY', stype = int8,
30 -- aggregate that only cares about null/nonnull input
31 CREATE AGGREGATE newcnt ("any") (
32 sfunc = int8inc_any, stype = int8,
35 -- multi-argument aggregate
36 create function sum3(int8,int8,int8) returns int8 as
37 'select $1 + $2 + $3' language sql strict immutable;
38 create aggregate sum2(int8,int8) (
39 sfunc = sum3, stype = int8,
42 COMMENT ON AGGREGATE nosuchagg (*) IS 'should fail';
43 ERROR: aggregate nosuchagg(*) does not exist
44 COMMENT ON AGGREGATE newcnt (*) IS 'an agg(*) comment';
45 COMMENT ON AGGREGATE newcnt ("any") IS 'an agg(any) comment';