Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: devel
Unsupported versions: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

44.2. 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.

Table 44-2. pg_aggregate Columns

Name Type References Description
aggfnoid regproc pg_proc.oid pg_proc OID of the aggregate function
aggtransfn regproc pg_proc.oid Transition 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 of the aggregate function's internal transition (state) data
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

New aggregate functions are registered with the CREATE AGGREGATE command. See Section 34.10 for more information about writing aggregate functions and the meaning of the transition functions, etc.