Updated on 2025-09-18 GMT+08:00

PG_AGGREGATE

pg_aggregate stores information related to aggregate functions. Each record in PG_AGGREGATE is an extension of a record in PG_PROC. PG_PROC records the name of the aggregate, its input and output data types, and other information similar to regular functions.

Table 1 PG_AGGREGATE columns

Column

Type

Reference

Description

aggfnoid

regproc

PG_PROC.oid

OID of this aggregate function in PG_PROC.

aggtransfn

regproc

PG_PROC.oid

Transition function.

aggcollectfn

regproc

PG_PROC.oid

Collect function.

aggfinalfn

regproc

PG_PROC.oid

Final function (zero if none).

aggsortop

oid

PG_OPERATOR.oid

Associated sort operator (zero if none).

aggtranstype

oid

PG_TYPE.oid

Data type for the internal transition (state) data of this aggregate function.

agginitval

text

-

Initial value for the transition state. This is a text column containing the external string representation of the initial value. If this column is null, the transition state begins as null.

agginitcollect

text

-

Initial value for the collect state. This is a text column containing the external string representation of the initial value. If this column is null, the collect state begins as null.