1997-04-06 01:07:13 -05:00
|
|
|
--
|
2000-01-05 12:32:29 -05:00
|
|
|
-- CREATE_AGGREGATE
|
1997-04-06 01:07:13 -05:00
|
|
|
--
|
|
|
|
|
|
|
|
|
|
-- all functions CREATEd
|
|
|
|
|
CREATE AGGREGATE newavg (
|
2000-07-16 23:05:41 -04:00
|
|
|
sfunc = int4_accum, basetype = int4, stype = _numeric,
|
|
|
|
|
finalfunc = numeric_avg,
|
|
|
|
|
initcond1 = '{0,0,0}'
|
1997-04-06 01:07:13 -05:00
|
|
|
);
|
|
|
|
|
|
2003-11-21 17:32:49 -05:00
|
|
|
-- test comments
|
|
|
|
|
COMMENT ON AGGREGATE newavg_wrong (int4) IS 'an agg comment';
|
|
|
|
|
COMMENT ON AGGREGATE newavg (int4) IS 'an agg comment';
|
|
|
|
|
COMMENT ON AGGREGATE newavg (int4) IS NULL;
|
|
|
|
|
|
2000-07-16 23:05:41 -04:00
|
|
|
-- without finalfunc; test obsolete spellings 'sfunc1' etc
|
1997-04-06 01:07:13 -05:00
|
|
|
CREATE AGGREGATE newsum (
|
|
|
|
|
sfunc1 = int4pl, basetype = int4, stype1 = int4,
|
|
|
|
|
initcond1 = '0'
|
|
|
|
|
);
|
|
|
|
|
|
2000-07-16 23:05:41 -04:00
|
|
|
-- value-independent transition function
|
1997-04-06 01:07:13 -05:00
|
|
|
CREATE AGGREGATE newcnt (
|
2000-07-16 23:05:41 -04:00
|
|
|
sfunc = int4inc, basetype = 'any', stype = int4,
|
|
|
|
|
initcond = '0'
|
1997-04-06 01:07:13 -05:00
|
|
|
);
|
|
|
|
|
|
2003-11-21 17:32:49 -05:00
|
|
|
COMMENT ON AGGREGATE nosuchagg (*) IS 'should fail';
|
|
|
|
|
COMMENT ON AGGREGATE newcnt (*) IS 'an any agg comment';
|
|
|
|
|
COMMENT ON AGGREGATE newcnt (*) IS NULL;
|