Skip to main content
Version: 2.x

pg_proc

The pg_proc system catalog table stores information about functions (or procedures), both built-in functions and those defined by CREATE FUNCTION. The table contains data for aggregate and window functions as well as plain functions. If proisagg is true, there should be a matching row in pg_aggregate.

For compiled functions, both built-in and dynamically loaded, prosrc contains the function's C-language name (link symbol). For all other currently-known language types, prosrc contains the function's source text. probin is unused except for dynamically-loaded C functions, for which it gives the name of the shared library file containing the function.

columntypereferencesdescription
oidoid Row identifier (hidden attribute; must be explicitly selected).
pronamename Name of the function.
pronamespaceoidpg_namespace.oidThe OID of the namespace that contains this function.
proowneroidpg_authid.oidOwner of the function.
prolangoidpg_language.oidImplementation language or call interface of this function.
procostreal Estimated execution cost (in cpu_operator_cost units); if proretset is true, identifies the cost per row returned.
prorowsreal Estimated number of result rows (zero if not proretset).
provariadicoidpg_type.oidData type of the variadic array parameter's elements, or zero if the function does not have a variadic parameter.
prosupportregprocpg_proc.oidPlanner support function for this function
prokindcharf for a normal function, p for a procedure, a for an aggregate function, or w for a window function
prosecdefboolean Function is a security definer (for example, a 'setuid' function).
proleakproofboolean 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.
proisstrictboolean Function returns NULL if any call argument is NULL. In that case the function will not actually be called at all. Functions that are not strict must be prepared to handle NULL inputs.
proretsetboolean Function returns a set (multiple values of the specified data type).
provolatilechar Tells whether the function's result depends only on its input arguments, or is affected by outside factors. i = immutable (always delivers the same result for the same inputs), s = stable (results (for fixed inputs) do not change within a scan), or v = volatile (results may change at any time or functions with side-effects).
proparallelcharIndicates whether a function can be safely run in a parallel backend, or only in non-parallel mode
pronargssmallint Number of arguments.
pronargdefaultssmallint Number of arguments that have default values.
prorettypeoidpg_type.oidData type of the return value, or null for a procedure.
proargtypesARRAYpg_type.oidAn 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.
proallargtypesARRAYpg_type.oidAn array with the data types of the function arguments. This includes all arguments (including OUT and INOUT arguments); however, if all of 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.
proargmodesARRAY An array with the modes of the function arguments: i = IN, o = OUT , b = INOUT, v = VARIADIC. If all the arguments are IN arguments, this field will be null. Note that subscripts correspond to positions of proallargtypes, not proargtypes.
proargnamesARRAY 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.
proargdefaultspg_node_tree Expression trees (in nodeToString() representation) for default argument 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.
protrftypesARRAYTypes for which to apply transforms
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_treeIf prolang is sql and prokind is not a (for example, it is a plain function or procedure, not an aggregate), this field contains the pre-parsed SQL body of the function or procedure. This is primarily for internal use by the database. For functions in other languages, this field is null.
proconfigARRAY Function's local settings for run-time configuration variables.
proaclARRAY Access privileges for the function as given by GRANT/REVOKE.
prodataaccesscharIndicates the SQL data access mode of the function. Possible values are: c = CONTAINS SQL, n = NO SQL, r = READS SQL DATA, m = MODIFIES SQL DATA.
proexeclocationchar Where the function runs when it is invoked: m - coordinator only, a - any segment instance, s - all segment instances, i - initplan.