5
-- all functions CREATEd
6
CREATE AGGREGATE newavg (
7
sfunc = int4_avg_accum, basetype = int4, stype = _int8,
13
COMMENT ON AGGREGATE newavg_wrong (int4) IS 'an agg comment';
14
COMMENT ON AGGREGATE newavg (int4) IS 'an agg comment';
15
COMMENT ON AGGREGATE newavg (int4) IS NULL;
17
-- without finalfunc; test obsolete spellings 'sfunc1' etc
18
CREATE AGGREGATE newsum (
19
sfunc1 = int4pl, basetype = int4, stype1 = int4,
23
-- zero-argument aggregate
24
CREATE AGGREGATE newcnt (*) (
25
sfunc = int8inc, stype = int8,
29
-- old-style spelling of same
30
CREATE AGGREGATE oldcnt (
31
sfunc = int8inc, basetype = 'ANY', stype = int8,
35
-- aggregate that only cares about null/nonnull input
36
CREATE AGGREGATE newcnt ("any") (
37
sfunc = int8inc_any, stype = int8,
41
-- multi-argument aggregate
42
create function sum3(int8,int8,int8) returns int8 as
43
'select $1 + $2 + $3' language sql strict immutable;
45
create aggregate sum2(int8,int8) (
46
sfunc = sum3, stype = int8,
50
COMMENT ON AGGREGATE nosuchagg (*) IS 'should fail';
51
COMMENT ON AGGREGATE newcnt (*) IS 'an agg(*) comment';
52
COMMENT ON AGGREGATE newcnt ("any") IS 'an agg(any) comment';