↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 系统目录 / 系统目录表

SYSTEM CATALOG系统目录表

pg_proc

函数和过程

系统目录表 引入 7.4(基线) 现存至 20 devel 12 次结构变更

关系 OID
1255
关系类型
r(普通表)
字段数
30
引入版本
7.4(收录基线)
版本状态
当前稳定版
结构变更
12 次

PostgreSQL 18 手册 官方文档 源码定义

版本轨迹

相对 PostgreSQL 17:描述更新 1 处。

目录 pg_proc 存放有关函数、过程、聚合函数以及窗口函数(统称为例程)的信息。更多信息请参考 CREATE FUNCTION、CREATE PROCEDURE 和第 36.3 节。

如果 prokind 显示该条目用于一个聚合函数,在 pg_aggregate 中应该有一个相匹配的行。

字段

PostgreSQL 18.7 的 30 个字段,按定义顺序排列。说明默认用本站手册的译文,没有译文的按英文原文显示。

字段 类型 说明
oid oidNOT NULL 行标识符
proname nameNOT NULL 函数的名字
pronamespace oidNOT NULL pg_namespace.oid 函数所属的名字空间的 OID
proowner oidNOT NULL pg_authid.oid 函数的拥有者
prolang oidNOT NULL pg_language.oid 此函数的实现语言或调用接口
procost realNOT NULL 估计的执行代价(以 cpu_operator_cost 为单位),如果 proretset 为真,这是每行返回的代价
prorows realNOT NULL 估计的结果行数量(如果 proretset 为假,该值为 0)
provariadic oidNOT NULL pg_type.oid 可变参数数组的元素类型;如果函数没有可变参数,则为零
prosupport regprocNOT NULL pg_proc.oid 该函数的规划器支持函数(参见第 36.11 节),如果没有则为零
prokind "char"NOT NULL f 表示普通函数,p 表示过程,a 表示聚合函数,w 表示窗口函数
prosecdef booleanNOT NULL 函数是否为安全定义者函数(即“setuid”函数)
proleakproof booleanNOT NULL 该函数没有副作用。除返回值外,不会泄露任何关于参数的信息。任何可能因参数值而报错的函数都不是 leakproof。
proisstrict booleanNOT NULL 任一调用实参为 NULL 时,函数返回 NULL。在这种情况下,实际上根本不会调用该函数。非“严格”函数必须能够处理 NULL 输入。
proretset booleanNOT NULL 函数是否返回一个集合(即,指定数据类型的多个值)
provolatile "char"NOT NULL provolatile 表示函数的结果是否仅依赖输入实参,还是也受外部因素影响。i 表示“不变的”函数,相同输入总是产生相同结果。s 表示“稳定的”函数,对于固定输入,其结果在一次扫描内不变。v 表示“易失的”函数,其结果随时可能变化。(有副作用的函数也应使用 v,以免对它们的调用在优化时被消除。)
proparallel "char"NOT NULL proparallel 表示函数是否可以在并行模式下安全运行。s 表示可以不受限制地在并行模式下安全运行的函数。r 表示可以在并行模式下运行、但仅限并行组领导者执行的函数;并行工作者进程不能调用这些函数。u 表示在并行模式下不安全的函数;此类函数的存在会强制采用串行执行计划。
pronargs smallintNOT NULL 输入参数的个数
pronargdefaults smallintNOT NULL 具有默认值的参数个数
prorettype oidNOT NULL pg_type.oid 返回值的数据类型
proargtypes oidvectorNOT NULL pg_type.oid 一个函数参数的数据类型的数组。这只包括输入参数(含 INOUT 和 VARIADIC 参数),因此也表现了函数的调用签名。
proallargtypes oid[] pg_type.oid 一个函数参数的数据类型的数组。这包括所有参数(含 OUT 和 INOUT 参数)。但是,如果所有参数都是 IN 参数,此字段为 NULL。注意下标是从 1 开始,然而由于历史原因 proargtypes 的下标是从 0 开始。
proargmodes "char"[] 一个函数参数的模式的数组。这里包括:i 表示 IN 参数,o 表示 OUT 参数,b 表示 INOUT 参数,v 表示 VARIADIC 参数,t 表示 TABLE 参数。如果所有的参数都是 IN 参数,此字段为 NULL。注意这里的下标对应着 proallargtypes 而不是 proargtypes 中的位置。
proargnames text[] 一个函数参数的名字的数组。没有名字的参数在数组中设置为空字符串。如果没有一个参数有名字,此字段为 NULL。注意这里的下标对应着 proallargtypes 而不是 proargtypes 中的位置。
proargdefaults pg_node_tree 默认值的表达式树(以 nodeToString() 表示)。这是一个包含 pronargdefaults 个元素的列表,对应最后 N 个输入参数(即最后 N 个 proargtypes 位置)。如果没有参数具有默认值,则此字段为 NULL。
protrftypes oid[] pg_type.oid 需要应用转换的参数/结果数据类型数组(来自函数的 TRANSFORM 子句)。如果没有,则为 NULL。
prosrc textNOT NULL 此字段告诉函数处理器如何调用该函数。它可以是解释型语言函数的实际源代码、链接符号、文件名或其他内容,具体取决于实现语言和调用约定。
probin text 关于如何调用函数的附加信息。其解释是与语言相关的。
prosqlbody pg_node_tree 预解析的 SQL 函数体。当 SQL 语言函数的函数体采用 SQL 标准表示法给出,而非字符串字面量时,使用此字段。其他情况下为 NULL。
proconfig text[] 函数对于运行时配置变量的本地设置值
proacl aclitem[] 访问权限,详见第 5.8 节

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的字段表。

  1. PostgreSQL 19 ← 18 仅描述更新

    1 处描述更新
    • proacl Access privileges; see Section 5.8 for details Access privileges; see Section 5.9 for details
  2. PostgreSQL 18 ← 17 仅描述更新

    1 处描述更新
    • proleakproof The function has no side effects. No information about the arguments is conveyed except via the return value. Any function that might throw an error depending on the values of its arguments is not leak-proof. The function has no side effects. No information about the arguments is conveyed except via the return value. Any function that might throw an error depending on the values of its arguments is not leakproof.
  3. PostgreSQL 17 ← 16 仅描述更新

    关系说明更新

    2 处描述更新
    • proacl Access privileges; see Section 5.7 for details Access privileges; see Section 5.8 for details
    • prosupport Planner support function for this function (see Section 38.11), or zero if none Planner support function for this function (see Section 36.11), or zero if none
  4. PostgreSQL 14 ← 13 结构变更

    prosqlbody 关系说明更新

    1 处描述更新
    • prosupport Optional planner support function for this function (see Section 37.11) Planner support function for this function (see Section 38.11), or zero if none
  5. PostgreSQL 13 ← 12 仅描述更新

    5 处描述更新
    • proallargtypes An array with the data types of the function arguments. This includes all arguments (including OUT and INOUT arguments); however, if all the arguments are IN arguments, this field will be null. Note that subscripting is 1-based, whereas for historical reasons proargtypes is subscripted from 0. An array of the data types of the function arguments. This includes all arguments (including OUT and INOUT arguments); however, if all the arguments are IN arguments, this field will be null. Note that subscripting is 1-based, whereas for historical reasons proargtypes is subscripted from 0.
    • proargmodes An array with the modes of the function arguments, encoded as i for IN arguments, o for OUT arguments, b for INOUT arguments, v for VARIADIC arguments, t for TABLE arguments. If all the arguments are IN arguments, this field will be null. Note that subscripts correspond to positions of proallargtypes not proargtypes. An array of the modes of the function arguments, encoded as i for IN arguments, o for OUT arguments, b for INOUT arguments, v for VARIADIC arguments, t for TABLE arguments. If all the arguments are IN arguments, this field will be null. Note that subscripts correspond to positions of proallargtypes not proargtypes.
    • proargnames An array with the names of the function arguments. Arguments without a name are set to empty strings in the array. If none of the arguments have a name, this field will be null. Note that subscripts correspond to positions of proallargtypes not proargtypes. An array of the names of the function arguments. Arguments without a name are set to empty strings in the array. If none of the arguments have a name, this field will be null. Note that subscripts correspond to positions of proallargtypes not proargtypes.
    • proargtypes An array with the data types of the function arguments. This includes only input arguments (including INOUT and VARIADIC arguments), and thus represents the call signature of the function. An array of the data types of the function arguments. This includes only input arguments (including INOUT and VARIADIC arguments), and thus represents the call signature of the function.
    • protrftypes Data type OIDs for which to apply transforms. An array of the argument/result data type(s) for which to apply transforms (from the function's TRANSFORM clause). Null if none.
    1 处引用更新
    • protrftypes (无) pg_type.oid
  6. PostgreSQL 12 ← 11 结构变更

    prosupport protransform oid:隐式列 → 常规列 关系说明更新

    2 处描述更新
    • oid Row identifier (hidden attribute; must be explicitly selected) Row identifier
    • proacl Access privileges; see GRANT and REVOKE for details Access privileges; see Section 5.7 for details
  7. PostgreSQL 11 ← 10 结构变更

    prokind proisaggproiswindow 关系说明更新

    1 处描述更新
    • protransform Calls to this function can be simplified by this other function (see Section 37.9.10) Calls to this function can be simplified by this other function (see Section 38.10.10)
  8. PostgreSQL 10 ← 9.6 仅描述更新

    关系说明更新

    4 处描述更新
    • proisstrict Function returns null if any call argument is null. In that case the function won't actually be called at all. Functions that are not "strict" must be prepared to handle null inputs. Function returns null if any call argument is null. In that case the function won't actually be called at all. Functions that are not “strict” must be prepared to handle null inputs.
    • prosecdef Function is a security definer (i.e., a "setuid" function) Function is a security definer (i.e., a “setuid” function)
    • protransform Calls to this function can be simplified by this other function (see Section 36.9.11) Calls to this function can be simplified by this other function (see Section 37.9.10)
    • provolatile provolatile tells whether the function's result depends only on its input arguments, or is affected by outside factors. It is i for "immutable" functions, which always deliver the same result for the same inputs. It is s for "stable" functions, whose results (for fixed inputs) do not change within a scan. It is v for "volatile" functions, whose results might change at any time. (Use v also for functions with side-effects, so that calls to them cannot get optimized away.) provolatile tells whether the function's result depends only on its input arguments, or is affected by outside factors. It is i for “immutable” functions, which always deliver the same result for the same inputs. It is s for “stable” functions, whose results (for fixed inputs) do not change within a scan. It is v for “volatile” functions, whose results might change at any time. (Use v also for functions with side-effects, so that calls to them cannot get optimized away.)
  9. PostgreSQL 9.6 ← 9.5 结构变更

    proparallel 关系说明更新

    1 处描述更新
    • protransform Calls to this function can be simplified by this other function (see Section 35.9.11) Calls to this function can be simplified by this other function (see Section 36.9.11)
  10. PostgreSQL 9.5 ← 9.4 结构变更

    protrftypes prosrc:可空 → 非空

  11. PostgreSQL 9.3 ← 9.2 仅描述更新

    1 处描述更新
    • oid Row identifier (hidden system attribute; explicitly select oid). Row identifier (hidden attribute; must be explicitly selected)
  12. PostgreSQL 9.2 ← 9.1 结构变更

    protransformproleakproof

  13. PostgreSQL 9.1 ← 9.0 结构变更

    proargdefaults:text → pg_node_tree

  14. PostgreSQL 9.0 ← 8.4 结构变更

    oid probin:bytea → text

  15. PostgreSQL 8.4 ← 8.3 结构变更

    provariadicproiswindowpronargdefaultsproargdefaults

  16. PostgreSQL 8.3 ← 8.2 结构变更

    procostprorowsproconfig

  17. PostgreSQL 8.1 ← 8.0 结构变更

    proallargtypesproargmodes proowner:int4 → oid

  18. PostgreSQL 8.0 ← 7.4 结构变更

    proargnames

字段矩阵

每个字段在 24 个收录版本里的存在情况;方格指向该版的字段表。「有变」指类型、可空、隐式或数组维数与上一版不同。

存在 有变 已移除 不存在

字段 7.48.08.18.28.38.49.09.19.29.39.49.59.61011121314151617181920
proname 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
pronamespace 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proowner 存在 存在 有变 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
prolang 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proisagg 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 已移除 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
prosecdef 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
proisstrict 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
proretset 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
provolatile 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
pronargs 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
prorettype 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proargtypes 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
prosrc 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
probin 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proacl 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proargnames 不存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proallargtypes 不存在 不存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proargmodes 不存在 不存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
procost 不存在 不存在 不存在 不存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
prorows 不存在 不存在 不存在 不存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
proconfig 不存在 不存在 不存在 不存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
provariadic 不存在 不存在 不存在 不存在 不存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proiswindow 不存在 不存在 不存在 不存在 不存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 已移除 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
pronargdefaults 不存在 不存在 不存在 不存在 不存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
proargdefaults 不存在 不存在 不存在 不存在 不存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
oid 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变 存在 存在 存在 存在 存在 存在 存在 存在
protransform 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 已移除 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
proleakproof 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
protrftypes 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
proparallel 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
prokind 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 有变
prosupport 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在 存在
prosqlbody 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在

系统列

每张表都有的 6 个系统列
  • tableoidoid-6
  • cmaxcid-5
  • xmaxxid-4
  • cmincid-3
  • xminxid-2
  • ctidtid-1

同类关系

关系 引入 字段 版本变动 最近变更
SYSTEM CATALOG 系统目录表 67 个 ↗
pg_aggregate 7.4基线 22 114 次
聚合函数 现存
pg_am 7.4基线 4 129 次
关系访问方法 现存
pg_amop 7.4基线 9 126 次
访问方法操作符 现存
pg_amproc 7.4基线 6 124 次
访问方法支持函数 现存
pg_attrdef 7.4基线 4 123 次
列默认值 现存
pg_attribute 7.4基线 25 1812 次
表列(“属性”) 现存
pg_auth_members 8.1 7 161 次
授权标识符成员关系 现存
pg_authid 8.1 12 124 次
授权标识符(角色) 现存
pg_autovacuum 8.1 10 8.21 次
目录pg_autovacuum存放自动清理守护进程的可选逐关系配置参数。如果某个特定关系在这里有条目,则给定的参数将用于对该表做自动清理。如果没有条目,将使用系统范围的默认值。关于自动清理守护进程的更多信息,见第 23.1.4 节。 于 8.4 移除
pg_cast 7.4基线 6 123 次
转换(数据类型转换) 现存
pg_class 7.4基线 34 1814 次
表、索引、序列、视图(“关系”) 现存
pg_collation 9.1 12 175 次
排序规则(区域设置信息) 现存
pg_constraint 7.4基线 28 1810 次
检查约束、唯一约束、主键约束、外键约束 现存
pg_conversion 7.4基线 8 123 次
编码转换信息 现存
pg_database 7.4基线 18 1710 次
本数据库集簇中的数据库 现存
pg_db_role_setting 9.0 3 —
每角色和每数据库的设置 现存
pg_default_acl 9.0 5 121 次
对象类型的默认权限 现存
pg_depend 7.4基线 7 —
数据库对象间的依赖 现存
pg_description 7.4基线 4 9.51 次
数据库对象上的描述或注释 现存
pg_enum 8.3 4 123 次
枚举标签和值定义 现存
pg_event_trigger 9.3 7 121 次
事件触发器 现存
pg_extension 9.1 8 122 次
已安装扩展 现存
pg_foreign_data_wrapper 8.4 8 194 次
外部数据包装器定义 现存
pg_foreign_server 8.4 8 122 次
外部服务器定义 现存
pg_foreign_table 9.1 3 —
外部表的补充信息 现存
pg_index 7.4基线 21 159 次
索引的补充信息 现存
pg_inherits 7.4基线 4 141 次
表继承层次 现存
pg_init_privs 9.6 5 —
对象初始权限 现存
pg_language 7.4基线 9 123 次
编写函数的语言 现存
pg_largeobject 7.4基线 3 9.51 次
大对象的数据页 现存
pg_largeobject_metadata 9.0 3 121 次
大对象的元数据 现存
pg_listener 7.4基线 3 —
目录 pg_listener 支持LISTEN和NOTIFY命令。监听者为自己正在监听的每个通知名称在 pg_listener 中创建一个条目。通知者会扫描 pg_listener 并更新每个匹配的条目,以表明发生了一个通知。通知者还会(使用表中记录的 PID)发送信号,把监听者从睡眠中唤醒。 于 9.0 移除
pg_namespace 7.4基线 4 123 次
模式 现存
pg_opclass 7.4基线 9 124 次
访问方法操作符类 现存
pg_operator 7.4基线 15 124 次
操作符 现存
pg_opfamily 8.3 5 122 次
访问方法操作符族 现存
pg_parameter_acl 15 3 —
已授予权限的配置参数 现存
pg_partitioned_table 10 8 111 次
表的分区键的信息 现存
pg_pltemplate 8.1 8 9.53 次
过程语言的模板数据 于 13 移除
pg_policy 9.5 8 122 次
行安全性策略 现存
pg_proc 7.4基线 30 1412 次
函数和过程 现存
pg_publication 10 11 195 次
用于逻辑复制的发布 现存
pg_publication_namespace 15 3 —
模式到发布映射 现存
pg_publication_rel 10 6 193 次
关系与发布的映射 现存
pg_range 9.2 12 192 次
范围类型的信息 现存
pg_replication_origin 9.5 2 —
已注册的复制源 现存
pg_rewrite 7.4基线 8 125 次
查询重写规则 现存
pg_seclabel 9.1 5 9.51 次
数据库对象上的安全标签 现存
pg_sequence 10 8 —
有关序列的信息 现存
pg_shdepend 8.1 7 8.41 次
共享对象上的依赖 现存
pg_shdescription 8.2 3 9.51 次
共享对象上的注释 现存
pg_shseclabel 9.2 4 9.51 次
共享数据库对象上的安全标签 现存
pg_statistic 7.4基线 31 123 次
规划器统计信息 现存
pg_statistic_ext 10 9 174 次
扩展的规划器统计信息(定义) 现存
pg_statistic_ext_data 12 6 152 次
扩展的规划器统计信息(已构建的统计信息) 现存
pg_subscription 10 23 197 次
逻辑复制订阅 现存
pg_subscription_rel 10 4 131 次
订阅的关系状态 现存
pg_tablespace 8.0 5 124 次
本数据库集簇内的表空间 现存
pg_transform 9.5 5 121 次
转换(将数据类型转换为过程语言需要的形式) 现存
pg_trigger 7.4基线 19 137 次
触发器 现存
pg_ts_config 8.3 5 122 次
文本检索配置 现存
pg_ts_config_map 8.3 4 —
文本检索配置的词元映射 现存
pg_ts_dict 8.3 6 122 次
文本检索词典 现存
pg_ts_parser 8.3 8 122 次
文本检索解析器 现存
pg_ts_template 8.3 5 122 次
文本检索模板 现存
pg_type 7.4基线 32 149 次
数据类型 现存
pg_user_mapping 8.4 4 122 次
用户到外部服务器的映射 现存