↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / System Catalogs

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.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

kind
catalog
lang
en
measured attributes
true
metadata release
18.6
runtime verified
false
source
english-manual

Definition PG 18

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.

Catalog columns

ColumnTypeNullabilityDescription
oidoidNot nullRow identifier
pronamenameNot nullName of the function
pronamespaceoidNot nullThe OID of the namespace that contains this function
proowneroidNot nullOwner of the function
prolangoidNot nullImplementation language or call interface of this function
procostfloat4Not nullEstimated execution cost (in units of cpu_operator_cost); if proretset, this is cost per row returned
prorowsfloat4Not nullEstimated number of result rows (zero if not proretset)
provariadicoidNot nullData type of the variadic array parameter's elements, or zero if the function does not have a variadic parameter
prosupportregprocNot nullPlanner support function for this function (see Section 36.11), or zero if none
prokindcharNot nullf for a normal function, p for a procedure, a for an aggregate function, or w for a window function
prosecdefboolNot nullFunction is a security definer (i.e., a “setuid” function)
proleakproofboolNot nullThe 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.
proisstrictboolNot nullFunction 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.
proretsetboolNot nullFunction returns a set (i.e., multiple values of the specified data type)
provolatilecharNot nullprovolatile 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.)
proparallelcharNot nullproparallel 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.
pronargsint2Not nullNumber of input arguments
pronargdefaultsint2Not nullNumber of arguments that have defaults
prorettypeoidNot nullData type of the return value
proargtypesoidvectorNot nullAn 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[]NullableAn 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[]NullableAn 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[]NullableAn 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_treeNullableExpression 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[]NullableAn array of the argument/result data type(s) for which to apply transforms (from the function's TRANSFORM clause). Null if none.
prosrctextNot nullThis 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.
probintextNullableAdditional information about how to invoke the function. Again, the interpretation is language-specific.
prosqlbodypg_node_treeNullablePre-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[]NullableFunction's local settings for run-time configuration variables
proaclaclitem[]NullableAccess privileges; see Section 5.8 for details

Compare versions

Complete source facts

runtime columns

oid, proname, pronamespace, proowner, prolang, procost, prorows, provariadic, prosupport, prokind, prosecdef, proleakproof, proisstrict, proretset, provolatile, proparallel, pronargs, pronargdefaults, prorettype, proargtypes, proallargtypes, proargmodes, proargnames, proargdefaults, protrftypes, prosrc, probin, prosqlbody, proconfig, proacl

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · catalog-bilingual-repair:84a17e5a428ce2f2b93dc10cce9054c4c8e6244006f607cf4851c7b84a79c75b

Text language: en · catalog-bilingual-repair:84a17e5a428ce2f2b93dc10cce9054c4c8e6244006f607cf4851c7b84a79c75b