Skip to content
← Catalog atlas / pg_aggregate

SYSTEM CATALOG · System catalog

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.

First seen PG 9.0Last seen PG 19Columns 22

Checked column by column against a PostgreSQL 18.6 instance · Raw measurement record ↗

Columns PostgreSQL 18

pg_aggregate
COLUMNTYPEDESCRIPTION
aggfnoid regprocNOT NULL pg_proc OID of the aggregate functionReferences:pg_proc.oid
aggkind "char"NOT NULLDocumented as:char Aggregate kind: n for “normal” aggregates, o for “ordered-set” aggregates, or h for “hypothetical-set” aggregates
aggnumdirectargs smallintNOT NULLDocumented as:int2 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 regprocNOT NULL Transition functionReferences:pg_proc.oid
aggfinalfn regprocNOT NULL Final function (zero if none)References:pg_proc.oid
aggcombinefn regprocNOT NULL Combine function (zero if none)References:pg_proc.oid
aggserialfn regprocNOT NULL Serialization function (zero if none)References:pg_proc.oid
aggdeserialfn regprocNOT NULL Deserialization function (zero if none)References:pg_proc.oid
aggmtransfn regprocNOT NULL Forward transition function for moving-aggregate mode (zero if none)References:pg_proc.oid
aggminvtransfn regprocNOT NULL Inverse transition function for moving-aggregate mode (zero if none)References:pg_proc.oid
aggmfinalfn regprocNOT NULL Final function for moving-aggregate mode (zero if none)References:pg_proc.oid
aggfinalextra booleanNOT NULLDocumented as:bool True to pass extra dummy arguments to aggfinalfn
aggmfinalextra booleanNOT NULLDocumented as:bool True to pass extra dummy arguments to aggmfinalfn
aggfinalmodify "char"NOT NULLDocumented as:char 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 NULLDocumented as:char Like aggfinalmodify, but for the aggmfinalfn
aggsortop oidNOT NULL Associated sort operator (zero if none)References:pg_operator.oid
aggtranstype oidNOT NULL Data type of the aggregate function's internal transition (state) dataReferences:pg_type.oid
aggtransspace integerNOT NULLDocumented as:int4 Approximate average size (in bytes) of the transition state data, or zero to use a default estimate
aggmtranstype oidNOT NULL Data type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none)References:pg_type.oid
aggmtransspace integerNOT NULLDocumented as:int4 Approximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate
agginitval text 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 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.

Columns marked "implicit" are not included in SELECT *; some early statistics views are completed from same-version source, and the extra provenance is shown in the column description.

Common system columns 6

System attributes PostgreSQL provides, normally not expanded by SELECT *. Kept separately so they are not mixed in with ordinary columns.

ColumnsTypeattnum
tableoidoid-6
cmaxcid-5
xmaxxid-4
cmincid-3
xminxid-2
ctidtid-1

Column evolution matrix

Hover a cell for the column type
PresentAdded / type or attribute changeRemoved
COLUMN9.09.19.29.39.49.59.610111213141516171819
aggfnoid
aggtransfn
aggfinalfn
aggsortop
aggtranstype
agginitval
aggkind
aggnumdirectargs
aggmtransfn
aggminvtransfn
aggmfinalfn
aggfinalextra
aggmfinalextra
aggtransspace
aggmtranstype
aggmtransspace
aggminitval
aggcombinefn
aggserialfn
aggdeserialfn
aggfinalmodify
aggmfinalmodify

9.0 is the coverage baseline; a column already present in the baseline is not marked as added. The matrix aligns columns by name, so a rename appears as the old column removed and a new column added.

Evolution timeline

Changes between adjacent majors

PostgreSQL 19 ← 18

1 column description updates

PostgreSQL 11 ← 10

+ aggfinalmodify+ aggmfinalmodify

PostgreSQL 10 ← 9.6

1 column description updates

PostgreSQL 9.6 ← 9.5

+ aggcombinefn+ aggserialfn+ aggdeserialfn

PostgreSQL 9.4 ← 9.3

+ aggkind+ aggnumdirectargs+ aggmtransfn+ aggminvtransfn+ aggmfinalfn+ aggfinalextra+ aggmfinalextra+ aggtransspace+ aggmtranstype+ aggmtransspace+ aggminitval

Compare any two versions

Pick two versions to see added, removed, and retyped columns. The interactive comparison needs JavaScript; the evolution timeline reads fine without it.