↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / System Catalogs

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

ColumnTypeNullabilityDescription
aggfnoidregprocNot nullpg_proc OID of the aggregate function
aggkindcharNot nullAggregate kind: n for “normal” aggregates, o for “ordered-set” aggregates, or h for “hypothetical-set” aggregates
aggnumdirectargsint2Not nullNumber 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.
aggtransfnregprocNot nullTransition function
aggfinalfnregprocNot nullFinal function (zero if none)
aggcombinefnregprocNot nullCombine function (zero if none)
aggserialfnregprocNot nullSerialization function (zero if none)
aggdeserialfnregprocNot nullDeserialization function (zero if none)
aggmtransfnregprocNot nullForward transition function for moving-aggregate mode (zero if none)
aggminvtransfnregprocNot nullInverse transition function for moving-aggregate mode (zero if none)
aggmfinalfnregprocNot nullFinal function for moving-aggregate mode (zero if none)
aggfinalextraboolNot nullTrue to pass extra dummy arguments to aggfinalfn
aggmfinalextraboolNot nullTrue to pass extra dummy arguments to aggmfinalfn
aggfinalmodifycharNot nullWhether 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
aggmfinalmodifycharNot nullLike aggfinalmodify, but for the aggmfinalfn
aggsortopoidNot nullAssociated sort operator (zero if none)
aggtranstypeoidNot nullData type of the aggregate function's internal transition (state) data
aggtransspaceint4Not nullApproximate average size (in bytes) of the transition state data, or zero to use a default estimate
aggmtranstypeoidNot nullData type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none)
aggmtransspaceint4Not nullApproximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate
agginitvaltextNullableThe 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.
aggminitvaltextNullableThe 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