选择 打开 改范围 完整检索页

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

文档 / 系统目录 / 系统目录表

SYSTEM CATALOG系统目录表

pg_proc

函数和过程

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

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

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

版本轨迹

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

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

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

字段

PostgreSQL 18 的 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 可变数组参数的元素的数据类型,如果函数没有可变参数则为0
prosupport regprocNOT NULL pg_proc.oid 对于该函数的规划器支持函数(参见Section 36.11),如果没有则为零
prokind "char"NOT NULL f表示普通函数,p表示过程,a表示聚合函数,w表示窗口函数
prosecdef booleanNOT NULL 函数是一个安全性定义者(即,一个“setuid”函数)
proleakproof booleanNOT NULL 该函数没有副作用。除返回值外,不会泄露任何关于参数的信息。任何可能因参数值而报错的函数都不是 leakproof。
proisstrict booleanNOT NULL 当任一调用参数为 NULL 时,函数是否返回空值。在这种情况下,函数实际上根本不会被调用。非“strict”函数必须准备好处理空值输入。
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参数,这个域将为空。 注意下标是从1开始 ,然而由于历史原因proargtypes的下标是从0开始。
proargmodes "char"[] 一个函数参数的模式的数组。这里包括: i表示IN参数 , o表示OUT参数, b表示INOUT参数, v表示VARIADIC参数, t表示TABLE参数。 如果所有的参数都是IN参数,这个域为空。 注意这里的下标对应着proallargtypes而不是proargtypes中的位置。
proargnames text[] 一个函数参数的名字的数组。没有名字的参数在数组中设置为空字符串。如果没有一个参数有名字,这个域为空。 注意这里的下标对应着proallargtypes而不是proargtypes中的位置。
proargdefaults pg_node_tree 默认值的表达式树(按照nodeToString()的表现方式)。 这是一个pronargdefaults元素的列表,对应于最后N个input参数(即最后N个proargtypes位置)。 如果没有一个参数具有默认值,这个域为空。
protrftypes oid[] pg_type.oid 要应用转换的(来自函数的TRANSFORM子句)参数/结果数据类型的数组。如果没有则为空。
prosrc textNOT NULL 这个字段告诉函数处理器如何调用该函数。它可能是针对解释型语言的真实源码、一个链接符号、一个文件名,或任何其他取决于实现语言/调用约定的内容。
probin text 关于如何调用函数的附加信息。其解释是与语言相关的。
prosqlbody pg_node_tree 预解析的 SQL 函数体。 当函数体采用 SQL 标准表示法给出,而不是作为字符串文本给出时,此字段用于 SQL 语言函数。 其他情况下为空。
proconfig text[] 函数对于运行时配置变量的本地设置值
proacl aclitem[] 访问权限,详见Section 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

字段矩阵

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

存在 有变 已移除 不存在

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

系统列

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

同类关系

关系 引入 字段 版本变动 最近变更
SYSTEM CATALOG 系统目录表 70 个
pg_aggregate 9.0基线 22 113 次
聚合函数 现存
pg_am 9.0基线 4 124 次
关系访问方法 现存
pg_amop 9.0基线 9 122 次
访问方法操作符 现存
pg_amproc 9.0基线 6 121 次
访问方法支持函数 现存
pg_attrdef 9.0基线 4 122 次
列默认值 现存
pg_attribute 9.0基线 25 189 次
表列(“属性”) 现存
pg_auth_members 9.0基线 7 161 次
授权标识符成员关系 现存
pg_authid 9.0基线 12 123 次
授权标识符(角色) 现存
pg_cast 9.0基线 6 121 次
转换(数据类型转换) 现存
pg_class 9.0基线 34 189 次
表、索引、序列、视图 (“关系”) 现存
pg_collation 9.1 12 175 次
排序规则(区域设置信息) 现存
pg_constraint 9.0基线 28 187 次
检查约束、唯一约束、主键约束、外键约束 现存
pg_conversion 9.0基线 8 121 次
编码转换信息 现存
pg_database 9.0基线 18 175 次
本数据库集簇中的数据库 现存
pg_db_role_setting 9.0基线 3
每角色和每数据库的设置 现存
pg_default_acl 9.0基线 5 121 次
对象类型的默认权限 现存
pg_depend 9.0基线 7
数据库对象间的依赖 现存
pg_description 9.0基线 4 9.51 次
数据库对象上的描述或注释 现存
pg_enum 9.0基线 4 122 次
枚举标签和值定义 现存
pg_event_trigger 9.3 7 121 次
事件触发器 现存
pg_extension 9.1 8 122 次
已安装扩展 现存
pg_foreign_data_wrapper 9.0基线 8 193 次
外部数据包装器定义 现存
pg_foreign_server 9.0基线 8 121 次
外部服务器定义 现存
pg_foreign_table 9.1 3
外部表信息 现存
pg_index 9.0基线 21 155 次
索引信息 现存
pg_inherits 9.0基线 4 141 次
表继承层次 现存
pg_init_privs 9.6 5
对象初始权限 现存
pg_language 9.0基线 9 121 次
编写函数的语言 现存
pg_largeobject 9.0基线 3 9.51 次
大对象的数据页 现存
pg_largeobject_metadata 9.0基线 3 121 次
大对象的元数据 现存
pg_namespace 9.0基线 4 121 次
模式 现存
pg_opclass 9.0基线 9 121 次
访问方法操作符类 现存
pg_operator 9.0基线 15 121 次
操作符 现存
pg_opfamily 9.0基线 5 121 次
访问方法操作符族 现存
pg_parameter_acl 15 3
已授予权限的配置参数 现存
pg_partitioned_table 10 8 111 次
表的分区键的信息 现存
pg_pltemplate 9.0基线 8 9.51 次
过程语言的模板数据 于 13 移除
pg_policy 9.5 8 122 次
行安全策略 现存
pg_proc 9.0基线 30 147 次
函数和过程 现存
pg_propgraph_element 19 14
属性图元素(顶点和边) 于 20 移除
pg_propgraph_element_label 19 3
属性图中元素与标签之间的链接 于 20 移除
pg_propgraph_label 19 3
属性图标签 于 20 移除
pg_propgraph_label_property 19 4
属性图中按标签区分的属性定义 于 20 移除
pg_propgraph_property 19 6
属性图属性 于 20 移除
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 9.0基线 8 123 次
查询重写规则 现存
pg_seclabel 9.1 5 9.51 次
数据库对象上的安全标签 现存
pg_sequence 10 8
有关序列的信息 现存
pg_shdepend 9.0基线 7
共享对象上的依赖 现存
pg_shdescription 9.0基线 3 9.51 次
共享对象上的注释 现存
pg_shseclabel 9.2 4 9.51 次
共享数据库对象上的安全标签 现存
pg_statistic 9.0基线 31 122 次
规划器统计 现存
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 9.0基线 5 122 次
本数据库集簇内的表空间 现存
pg_transform 9.5 5 121 次
转换(将数据类型转换为过程语言需要的形式) 现存
pg_trigger 9.0基线 19 135 次
触发器 现存
pg_ts_config 9.0基线 5 121 次
文本搜索配置 现存
pg_ts_config_map 9.0基线 4
文本搜索配置的词元映射 现存
pg_ts_dict 9.0基线 6 121 次
文本搜索字典 现存
pg_ts_parser 9.0基线 8 121 次
文本搜索分析器 现存
pg_ts_template 9.0基线 5 121 次
文本搜索模板 现存
pg_type 9.0基线 32 144 次
数据类型 现存
pg_user_mapping 9.0基线 4 121 次
将用户映射到外部服务器 现存