pg_aggregate
是一个存储关于聚合函数信息的系统目录表。
按 PostgreSQL 版本定义
pg_aggregate (PostgreSQL 17)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" PRIMARY KEY, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 16)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" PRIMARY KEY, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 15)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" PRIMARY KEY, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 14)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" PRIMARY KEY, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 13)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 12)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | C | | aggminitval | text | C | | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 11)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggfinalmodify | "char" | | not null | aggmfinalmodify | "char" | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | | | aggminitval | text | | | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 10)
Table "pg_catalog.pg_aggregate" Column | Type | Collation | Nullable | Default ------------------+----------+-----------+----------+--------- aggfnoid | regproc | | not null | aggkind | "char" | | not null | aggnumdirectargs | smallint | | not null | aggtransfn | regproc | | not null | aggfinalfn | regproc | | not null | aggcombinefn | regproc | | not null | aggserialfn | regproc | | not null | aggdeserialfn | regproc | | not null | aggmtransfn | regproc | | not null | aggminvtransfn | regproc | | not null | aggmfinalfn | regproc | | not null | aggfinalextra | boolean | | not null | aggmfinalextra | boolean | | not null | aggsortop | oid | | not null | aggtranstype | oid | | not null | aggtransspace | integer | | not null | aggmtranstype | oid | | not null | aggmtransspace | integer | | not null | agginitval | text | | | aggminitval | text | | | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.6)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers ------------------+----------+----------- aggfnoid | regproc | not null aggkind | "char" | not null aggnumdirectargs | smallint | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggcombinefn | regproc | not null aggserialfn | regproc | not null aggdeserialfn | regproc | not null aggmtransfn | regproc | not null aggminvtransfn | regproc | not null aggmfinalfn | regproc | not null aggfinalextra | boolean | not null aggmfinalextra | boolean | not null aggsortop | oid | not null aggtranstype | oid | not null aggtransspace | integer | not null aggmtranstype | oid | not null aggmtransspace | integer | not null agginitval | text | aggminitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.5)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers ------------------+----------+----------- aggfnoid | regproc | not null aggkind | "char" | not null aggnumdirectargs | smallint | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggmtransfn | regproc | not null aggminvtransfn | regproc | not null aggmfinalfn | regproc | not null aggfinalextra | boolean | not null aggmfinalextra | boolean | not null aggsortop | oid | not null aggtranstype | oid | not null aggtransspace | integer | not null aggmtranstype | oid | not null aggmtransspace | integer | not null agginitval | text | aggminitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.4)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers ------------------+----------+----------- aggfnoid | regproc | not null aggkind | "char" | not null aggnumdirectargs | smallint | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggmtransfn | regproc | not null aggminvtransfn | regproc | not null aggmfinalfn | regproc | not null aggfinalextra | boolean | not null aggmfinalextra | boolean | not null aggsortop | oid | not null aggtranstype | oid | not null aggtransspace | integer | not null aggmtranstype | oid | not null aggmtransspace | integer | not null agginitval | text | aggminitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.3)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.2)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.1)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 9.0)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 8.4)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 8.3)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid)
文档: pg_aggregate
pg_aggregate (PostgreSQL 8.2)
Table "pg_catalog.pg_aggregate" Column | Type | Modifiers --------------+---------+----------- aggfnoid | regproc | not null aggtransfn | regproc | not null aggfinalfn | regproc | not null aggsortop | oid | not null aggtranstype | oid | not null agginitval | text | Indexes: "pg_aggregate_fnoid_index" UNIQUE, btree (aggfnoid oid_ops)
文档: pg_aggregate
更改历史记录
- PostgreSQL 11 - 添加了以下列
- PostgreSQL 9.6 - 添加了以下列
- PostgreSQL 9.4 - 添加了以下列
aggkind
(提交 8d65da1f)aggnumdirectargs
(提交 8d65da1f)aggmtransfn
(提交 a9d9acbf)aggminvtransfn
(提交 a9d9acbf)aggmfinalfn
(提交 a9d9acbf)aggfinalextra
(提交 f0fedfe8)aggmfinalextra
(提交 f0fedfe8)aggtransspace
(提交 6cb86143)aggmtransspace
(提交 a9d9acbf)aggmtranstype
(提交 a9d9acbf)aggminitval
(提交 a9d9acbf)
- PostgreSQL 8.1
- 添加了列
aggsortop
(提交 2e7a6889)
- 添加了列
- PostgreSQL 7.2
- 删除了列
aggname
- 删除了列
aggowner
- 删除了列
aggbasetype
- 删除了列
aggfinaltype
- 添加了列
aggfnoid
- 删除了列
示例
postgres=# SELECT * FROM pg_aggregate WHERE aggfnoid::TEXT ='pg_catalog.count' LIMIT 1\x\g\x Expanded display is on. -[ RECORD 1 ]----+----------------- aggfnoid | pg_catalog.count aggkind | n aggnumdirectargs | 0 aggtransfn | int8inc_any aggfinalfn | - aggcombinefn | int8pl aggserialfn | - aggdeserialfn | - aggmtransfn | int8inc_any aggminvtransfn | int8dec_any aggmfinalfn | - aggfinalextra | f aggmfinalextra | f aggfinalmodify | r aggmfinalmodify | r aggsortop | 0 aggtranstype | 20 aggtransspace | 0 aggmtranstype | 20 aggmtransspace | 0 agginitval | 0 aggminitval | 0
参考
- PostgreSQL 文档: pg_aggregate