Summary
The catalog pg_proc stores information about functions, procedures, aggregate functions, and window functions (collectively also known as routines). See createfunction, createprocedure, and xfunc for more information.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_proc system catalog exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
oidoid
Row identifierpronamename
Name of the functionpronamespaceoidreferencespg_namespace.oid
The OID of the namespace that contains this functionproowneroidreferencespg_authid.oid
Owner of the functionprolangoidreferencespg_language.oid
Implementation language or call interface of this functionprocostfloat4
Estimated execution cost (in units of cpu_operator_cost); if proretset, this is cost per row returnedprorowsfloat4
Estimated number of result rows (zero if not proretset)provariadicoidreferencespg_type.oid
Data type of the variadic array parameter’s elements, or zero if the function does not have a variadic parameterprosupportregprocreferencespg_proc.oid
Planner support function for this function (see xfunc_optimization), or zero if noneprokindchar
f for a normal function, p for a procedure, a for an aggregate function, or w for a window functionprosecdefbool
Function is a security definer (i.e., a “setuid” function)proleakproofbool
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.proisstrictbool
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.proretsetbool
Function returns a set (i.e., multiple values of the specified data type)provolatilechar
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.)proparallelchar
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.pronargsint2
Number of input argumentspronargdefaultsint2
Number of arguments that have defaultsprorettypeoidreferencespg_type.oid
Data type of the return valueproargtypesoidvectorreferencespg_type.oid
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.proallargtypesoid[]referencespg_type.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.proargmodeschar[]
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.proargnamestext[]
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.proargdefaultspg_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.protrftypesoid[]referencespg_type.oid
An array of the argument/result data type(s) for which to apply transforms (from the function’s TRANSFORM clause). Null if none.prosrctext
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.probintext
Additional information about how to invoke the function. Again, the interpretation is language-specific.prosqlbodypg_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.proconfigtext[]
Function’s local settings for run-time configuration variablesproaclaclitem[]
Access privileges; see ddl_priv for details
Related catalogs
This object references the following other system catalogs:
pronamespace→pg_namespaceproowner→pg_authidprolang→pg_languageprovariadic→pg_type
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_proc.