4 The catalog pg_aggregate stores information about aggregate functions.
5 An aggregate function is a function that operates on a set of values
6 (typically one column from each row that matches a query condition) and
7 returns a single value computed from all these values. Typical
8 aggregate functions are sum, count, and max. Each entry in pg_aggregate
9 is an extension of an entry in pg_proc. The pg_proc entry carries the
10 aggregate's name, input and output data types, and other information
11 that is similar to ordinary functions.
13 Table 52.2. pg_aggregate Columns
19 aggfnoid regproc (references pg_proc.oid)
21 pg_proc OID of the aggregate function
25 Aggregate kind: n for “normal” aggregates, o for “ordered-set”
26 aggregates, or h for “hypothetical-set” aggregates
30 Number of direct (non-aggregated) arguments of an ordered-set or
31 hypothetical-set aggregate, counting a variadic array as one argument.
32 If equal to pronargs, the aggregate must be variadic and the variadic
33 array describes the aggregated arguments as well as the final direct
34 arguments. Always zero for normal aggregates.
36 aggtransfn regproc (references pg_proc.oid)
40 aggfinalfn regproc (references pg_proc.oid)
42 Final function (zero if none)
44 aggcombinefn regproc (references pg_proc.oid)
46 Combine function (zero if none)
48 aggserialfn regproc (references pg_proc.oid)
50 Serialization function (zero if none)
52 aggdeserialfn regproc (references pg_proc.oid)
54 Deserialization function (zero if none)
56 aggmtransfn regproc (references pg_proc.oid)
58 Forward transition function for moving-aggregate mode (zero if none)
60 aggminvtransfn regproc (references pg_proc.oid)
62 Inverse transition function for moving-aggregate mode (zero if none)
64 aggmfinalfn regproc (references pg_proc.oid)
66 Final function for moving-aggregate mode (zero if none)
70 True to pass extra dummy arguments to aggfinalfn
74 True to pass extra dummy arguments to aggmfinalfn
78 Whether aggfinalfn modifies the transition state value: r if it is
79 read-only, s if the aggtransfn cannot be applied after the aggfinalfn,
80 or w if it writes on the value
84 Like aggfinalmodify, but for the aggmfinalfn
86 aggsortop oid (references pg_operator.oid)
88 Associated sort operator (zero if none)
90 aggtranstype oid (references pg_type.oid)
92 Data type of the aggregate function's internal transition (state) data
96 Approximate average size (in bytes) of the transition state data, or
97 zero to use a default estimate
99 aggmtranstype oid (references pg_type.oid)
101 Data type of the aggregate function's internal transition (state) data
102 for moving-aggregate mode (zero if none)
106 Approximate average size (in bytes) of the transition state data for
107 moving-aggregate mode, or zero to use a default estimate
111 The initial value of the transition state. This is a text field
112 containing the initial value in its external string representation. If
113 this field is null, the transition state value starts out null.
117 The initial value of the transition state for moving-aggregate mode.
118 This is a text field containing the initial value in its external
119 string representation. If this field is null, the transition state
120 value starts out null.
122 New aggregate functions are registered with the CREATE AGGREGATE
123 command. See Section 36.12 for more information about writing aggregate
124 functions and the meaning of the transition functions, etc.