跳转到主要内容
← 目录图谱 / pg_aggregate

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.

首次收录 PG 9.0最近收录 PG 19当前字段 22

已与 PostgreSQL 18.6 实例逐字段核对 · 原始实测记录 ↗

字段结构 PostgreSQL 18

pg_aggregate
字段 / COLUMN类型 / TYPE说明 / DESCRIPTION
aggfnoid regprocNOT NULL pg_proc OID of the aggregate function引用:pg_proc.oid
aggkind "char"NOT NULL文档原写法:char Aggregate kind: n for “normal” aggregates, o for “ordered-set” aggregates, or h for “hypothetical-set” aggregates
aggnumdirectargs smallintNOT NULL文档原写法: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 function引用:pg_proc.oid
aggfinalfn regprocNOT NULL Final function (zero if none)引用:pg_proc.oid
aggcombinefn regprocNOT NULL Combine function (zero if none)引用:pg_proc.oid
aggserialfn regprocNOT NULL Serialization function (zero if none)引用:pg_proc.oid
aggdeserialfn regprocNOT NULL Deserialization function (zero if none)引用:pg_proc.oid
aggmtransfn regprocNOT NULL Forward transition function for moving-aggregate mode (zero if none)引用:pg_proc.oid
aggminvtransfn regprocNOT NULL Inverse transition function for moving-aggregate mode (zero if none)引用:pg_proc.oid
aggmfinalfn regprocNOT NULL Final function for moving-aggregate mode (zero if none)引用:pg_proc.oid
aggfinalextra booleanNOT NULL文档原写法:bool True to pass extra dummy arguments to aggfinalfn
aggmfinalextra booleanNOT NULL文档原写法:bool True to pass extra dummy arguments to aggmfinalfn
aggfinalmodify "char"NOT NULL文档原写法: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 NULL文档原写法:char Like aggfinalmodify, but for the aggmfinalfn
aggsortop oidNOT NULL Associated sort operator (zero if none)引用:pg_operator.oid
aggtranstype oidNOT NULL Data type of the aggregate function's internal transition (state) data引用:pg_type.oid
aggtransspace integerNOT NULL文档原写法: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)引用:pg_type.oid
aggmtransspace integerNOT NULL文档原写法: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.

标记“隐式列”的字段不包含在 SELECT * 中;部分早期统计视图由同版本源码补全,额外来源会显示在字段说明中。

通用系统列 6

PostgreSQL 提供的系统属性,通常不在 SELECT * 中展开。单独保留,不与普通字段混算。

字段类型attnum
tableoidoid-6
cmaxcid-5
xmaxxid-4
cmincid-3
xminxid-2
ctidtid-1

字段演化矩阵

悬停查看字段类型
存在新增 / 类型或属性变化移除
字段 / 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 是收录基线;基线中已存在的字段不标记为新增。矩阵按字段名称对齐,重命名显示为旧字段移除与新字段新增。

演化时间线

相邻大版本的变化

PostgreSQL 19 ← 18

1 处字段说明更新

PostgreSQL 11 ← 10

+ aggfinalmodify+ aggmfinalmodify

PostgreSQL 10 ← 9.6

1 处字段说明更新

PostgreSQL 9.6 ← 9.5

+ aggcombinefn+ aggserialfn+ aggdeserialfn

PostgreSQL 9.4 ← 9.3

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

比较任意两个版本

选择两个版本,查看字段的新增、移除与类型变化。交互比较需要 JavaScript;演化时间线可直接阅读。