pg_aggregate

3.2. pg_aggregate

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 datatypes, and other information that is similar to ordinary functions.

Table 3-2. pg_aggregate Columns

NameTypeReferencesDescription
aggfnoidregprocpg_proc.oidpg_proc OID of the aggregate function
aggtransfnregprocpg_proc.oidTransition function
aggfinalfnregprocpg_proc.oidFinal function (zero if none)
aggtranstypeoidpg_type.oidThe type of the aggregate function's internal transition (state) data
agginitvaltext  The initial value of the transition state. This is a text field containing the initial value in its external string representation. If the field is NULL, the transition state value starts out NULL.

New aggregate functions are registered with the CREATE AGGREGATE command. See the Programmer's Guide for more information about writing aggregate functions and the meaning of the transition functions, etc.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.