aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/sql/create_aggregate.sql
blob: 4188760c87c21ece71153a8115017ca3c7be32e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--
-- CREATE_AGGREGATE
--

-- all functions CREATEd
CREATE AGGREGATE newavg (
   sfunc = int4_accum, basetype = int4, stype = _numeric, 
   finalfunc = numeric_avg,
   initcond1 = '{0,0,0}'
);

-- 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;

-- 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'
);

COMMENT ON AGGREGATE nosuchagg (*) IS 'should fail';
COMMENT ON AGGREGATE newcnt (*) IS 'an any agg comment';
COMMENT ON AGGREGATE newcnt (*) IS NULL;