]> begriffs open source - ai-pg/blob - full-docs/txt/catalog-pg-aggregate.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / catalog-pg-aggregate.txt
1
2 52.2. pg_aggregate #
3
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.
12
13    Table 52.2. pg_aggregate Columns
14
15    Column Type
16
17    Description
18
19    aggfnoid regproc (references pg_proc.oid)
20
21    pg_proc OID of the aggregate function
22
23    aggkind char
24
25    Aggregate kind: n for “normal” aggregates, o for “ordered-set”
26    aggregates, or h for “hypothetical-set” aggregates
27
28    aggnumdirectargs int2
29
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.
35
36    aggtransfn regproc (references pg_proc.oid)
37
38    Transition function
39
40    aggfinalfn regproc (references pg_proc.oid)
41
42    Final function (zero if none)
43
44    aggcombinefn regproc (references pg_proc.oid)
45
46    Combine function (zero if none)
47
48    aggserialfn regproc (references pg_proc.oid)
49
50    Serialization function (zero if none)
51
52    aggdeserialfn regproc (references pg_proc.oid)
53
54    Deserialization function (zero if none)
55
56    aggmtransfn regproc (references pg_proc.oid)
57
58    Forward transition function for moving-aggregate mode (zero if none)
59
60    aggminvtransfn regproc (references pg_proc.oid)
61
62    Inverse transition function for moving-aggregate mode (zero if none)
63
64    aggmfinalfn regproc (references pg_proc.oid)
65
66    Final function for moving-aggregate mode (zero if none)
67
68    aggfinalextra bool
69
70    True to pass extra dummy arguments to aggfinalfn
71
72    aggmfinalextra bool
73
74    True to pass extra dummy arguments to aggmfinalfn
75
76    aggfinalmodify char
77
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
81
82    aggmfinalmodify char
83
84    Like aggfinalmodify, but for the aggmfinalfn
85
86    aggsortop oid (references pg_operator.oid)
87
88    Associated sort operator (zero if none)
89
90    aggtranstype oid (references pg_type.oid)
91
92    Data type of the aggregate function's internal transition (state) data
93
94    aggtransspace int4
95
96    Approximate average size (in bytes) of the transition state data, or
97    zero to use a default estimate
98
99    aggmtranstype oid (references pg_type.oid)
100
101    Data type of the aggregate function's internal transition (state) data
102    for moving-aggregate mode (zero if none)
103
104    aggmtransspace int4
105
106    Approximate average size (in bytes) of the transition state data for
107    moving-aggregate mode, or zero to use a default estimate
108
109    agginitval text
110
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.
114
115    aggminitval text
116
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.
121
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.