pg_aggregate
The catalog pg_aggregate stores information about aggregate functions. An aggregate function is a function that operates on a set of values (typically one column from each row that matches a query condition) and returns a single value computed from all these values. Typical aggregate functions are sum, count, and max. Each entry in pg_aggregate is an extension of an entry in pg_proc. The pg_proc entry carries the aggregate's name, input and output data types, and other information that is similar to ordinary functions.
English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- kind
- catalog
- lang
- en
- measured attributes
- true
- metadata release
- 18.6
- runtime verified
- false
- source
- english-manual
Definition PG 18
The catalog pg_aggregate stores information about aggregate functions. An aggregate function is a function that operates on a set of values (typically one column from each row that matches a query condition) and returns a single value computed from all these values. Typical aggregate functions are sum, count, and max. Each entry in pg_aggregate is an extension of an entry in pg_proc. The pg_proc entry carries the aggregate's name, input and output data types, and other information that is similar to ordinary functions.
Catalog columns
| Column | Type | Nullability | Description |
|---|---|---|---|
| aggfnoid | regproc | Not null | pg_proc OID of the aggregate function |
| aggkind | char | Not null | Aggregate kind: n for “normal” aggregates, o for “ordered-set” aggregates, or h for “hypothetical-set” aggregates |
| aggnumdirectargs | int2 | Not null | Number of direct (non-aggregated) arguments of an ordered-set or hypothetical-set aggregate, counting a variadic array as one argument. If equal to pronargs, the aggregate must be variadic and the variadic array describes the aggregated arguments as well as the final direct arguments. Always zero for normal aggregates. |
| aggtransfn | regproc | Not null | Transition function |
| aggfinalfn | regproc | Not null | Final function (zero if none) |
| aggcombinefn | regproc | Not null | Combine function (zero if none) |
| aggserialfn | regproc | Not null | Serialization function (zero if none) |
| aggdeserialfn | regproc | Not null | Deserialization function (zero if none) |
| aggmtransfn | regproc | Not null | Forward transition function for moving-aggregate mode (zero if none) |
| aggminvtransfn | regproc | Not null | Inverse transition function for moving-aggregate mode (zero if none) |
| aggmfinalfn | regproc | Not null | Final function for moving-aggregate mode (zero if none) |
| aggfinalextra | bool | Not null | True to pass extra dummy arguments to aggfinalfn |
| aggmfinalextra | bool | Not null | True to pass extra dummy arguments to aggmfinalfn |
| aggfinalmodify | char | Not null | Whether aggfinalfn modifies the transition state value: r if it is read-only, s if the aggtransfn cannot be applied after the aggfinalfn, or w if it writes on the value |
| aggmfinalmodify | char | Not null | Like aggfinalmodify, but for the aggmfinalfn |
| aggsortop | oid | Not null | Associated sort operator (zero if none) |
| aggtranstype | oid | Not null | Data type of the aggregate function's internal transition (state) data |
| aggtransspace | int4 | Not null | Approximate average size (in bytes) of the transition state data, or zero to use a default estimate |
| aggmtranstype | oid | Not null | Data type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none) |
| aggmtransspace | int4 | Not null | Approximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate |
| agginitval | text | Nullable | The initial value of the transition state. This is a text field containing the initial value in its external string representation. If this field is null, the transition state value starts out null. |
| aggminitval | text | Nullable | The initial value of the transition state for moving-aggregate mode. This is a text field containing the initial value in its external string representation. If this field is null, the transition state value starts out null. |
Compare versions
Complete source facts
runtime columns
aggfnoid, aggkind, aggnumdirectargs, aggtransfn, aggfinalfn, aggcombinefn, aggserialfn, aggdeserialfn, aggmtransfn, aggminvtransfn, aggmfinalfn, aggfinalextra, aggmfinalextra, aggfinalmodify, aggmfinalmodify, aggsortop, aggtranstype, aggtransspace, aggmtranstype, aggmtransspace, agginitval, aggminitval
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · catalog-bilingual-repair:e2b85c780ad781604927cd720219a484bd8991b174377e71c03882be1b4e63d8
Text language: en · catalog-bilingual-repair:e2b85c780ad781604927cd720219a484bd8991b174377e71c03882be1b4e63d8