pg_aggregate

The pg_aggregate table 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.

Table 1. pg_catalog.pg_aggregate

columntypereferencesdescription
aggfnoidregprocpg_proc.oidAggregate function OID
aggtransfnregprocpg_proc.oidTransition function OID
aggprelimfnregproc Preliminary function OID (zero if none)
aggfinalfnregprocpg_proc.oidFinal function OID (zero if none)
agginitvaltext 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
agginvtransfnregprocpg_proc.oidThe OID in pg_proc of the inverse function of aggtransfn
agginvprelimfnregprocpg_proc.oidThe OID in pg_proc of the inverse function of aggprelimfn
aggorderedboolean If true, the aggregate is defined as ORDERED.
aggsortopoidpg_operator.oidAssociated sort operator OID (zero if none)
aggtranstypeoidpg_type.oidData type of the aggregate function’s internal transition (state) data