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

SYSTEM CATALOG · 系统目录

pg_proc

The catalog pg_proc stores information about functions, procedures, aggregate functions, and window functions (collectively also known as routines). See CREATE FUNCTION, CREATE PROCEDURE, and Section 36.3 for more information. If prokind indicates that the entry is for an aggregate function, there should be a matching row in pg_aggregate.

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

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

字段结构 PostgreSQL 18

pg_proc
字段 / COLUMN类型 / TYPE说明 / DESCRIPTION
oid oidNOT NULL Row identifier
proname nameNOT NULL Name of the function
pronamespace oidNOT NULL The OID of the namespace that contains this function引用:pg_namespace.oid
proowner oidNOT NULL Owner of the function引用:pg_authid.oid
prolang oidNOT NULL Implementation language or call interface of this function引用:pg_language.oid
procost realNOT NULL文档原写法:float4 Estimated execution cost (in units of cpu_operator_cost); if proretset, this is cost per row returned
prorows realNOT NULL文档原写法:float4 Estimated number of result rows (zero if not proretset)
provariadic oidNOT NULL Data type of the variadic array parameter's elements, or zero if the function does not have a variadic parameter引用:pg_type.oid
prosupport regprocNOT NULL Planner support function for this function (see Section 36.11), or zero if none引用:pg_proc.oid
prokind "char"NOT NULL文档原写法:char f for a normal function, p for a procedure, a for an aggregate function, or w for a window function
prosecdef booleanNOT NULL文档原写法:bool Function is a security definer (i.e., a “setuid” function)
proleakproof booleanNOT NULL文档原写法:bool 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.
proisstrict booleanNOT NULL文档原写法:bool 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.
proretset booleanNOT NULL文档原写法:bool Function returns a set (i.e., multiple values of the specified data type)
provolatile "char"NOT NULL文档原写法:char 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.)
proparallel "char"NOT NULL文档原写法:char proparallel tells whether the function can be safely run in parallel mode. It is s for functions which are safe to run in parallel mode without restriction. It is r for functions which can be run in parallel mode, but their execution is restricted to the parallel group leader; parallel worker processes cannot invoke these functions. It is u for functions which are unsafe in parallel mode; the presence of such a function forces a serial execution plan.
pronargs smallintNOT NULL文档原写法:int2 Number of input arguments
pronargdefaults smallintNOT NULL文档原写法:int2 Number of arguments that have defaults
prorettype oidNOT NULL Data type of the return value引用:pg_type.oid
proargtypes oidvectorNOT NULL 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.引用:pg_type.oid
proallargtypes oid[] 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.引用:pg_type.oid
proargmodes "char"[]文档原写法:char[] 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 text[] 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.
proargdefaults pg_node_tree Expression trees (in nodeToString() representation) for default values. This is a list with pronargdefaults elements, corresponding to the last N input arguments (i.e., the last N proargtypes positions). If none of the arguments have defaults, this field will be null.
protrftypes oid[] An array of the argument/result data type(s) for which to apply transforms (from the function's TRANSFORM clause). Null if none.引用:pg_type.oid
prosrc textNOT NULL This tells the function handler how to invoke the function. It might be the actual source code of the function for interpreted languages, a link symbol, a file name, or just about anything else, depending on the implementation language/call convention.
probin text Additional information about how to invoke the function. Again, the interpretation is language-specific.
prosqlbody pg_node_tree Pre-parsed SQL function body. This is used for SQL-language functions when the body is given in SQL-standard notation rather than as a string literal. It's null in other cases.
proconfig text[] Function's local settings for run-time configuration variables
proacl aclitem[] Access privileges; see Section 5.8 for details

标记“隐式列”的字段不包含在 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
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

9.0 是收录基线;基线中已存在的字段不标记为新增。矩阵按字段名称对齐,重命名显示为旧字段移除与新字段新增。

演化时间线

相邻大版本的变化

PostgreSQL 19 ← 18

1 处字段说明更新

PostgreSQL 18 ← 17

1 处字段说明更新

PostgreSQL 17 ← 16

2 处字段说明更新目录说明更新

PostgreSQL 14 ← 13

+ prosqlbody1 处字段说明更新目录说明更新

PostgreSQL 13 ← 12

5 处字段说明更新1 处引用更新

PostgreSQL 12 ← 11

+ prosupport− protransform~ oid: 隐式列 → 常规列2 处字段说明更新目录说明更新

PostgreSQL 11 ← 10

+ prokind− proisagg− proiswindow1 处字段说明更新目录说明更新

PostgreSQL 10 ← 9.6

4 处字段说明更新目录说明更新

PostgreSQL 9.6 ← 9.5

+ proparallel1 处字段说明更新目录说明更新

PostgreSQL 9.5 ← 9.4

+ protrftypes~ prosrc: not_null: false → true

PostgreSQL 9.3 ← 9.2

1 处字段说明更新

PostgreSQL 9.2 ← 9.1

+ protransform+ proleakproof

PostgreSQL 9.1 ← 9.0

~ proargdefaults: text → pg_node_tree

比较任意两个版本

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