Updated on 2025-08-25 GMT+08:00

PG_PROC

PG_PROC stores information about all built-in functions.

Table 1 PG_PROC columns

Column

Type

Description

proname

name

Name of a function.

pronamespace

oid

OID of the namespace where the function is.

proowner

oid

Owner of the function.

prolang

oid

Implementation language or function call interface.

procost

real

Estimated execution cost.

prorows

real

Estimated number of result rows.

provariadic

oid

Data type of parameter elements.

protransform

regproc

Simplified call method for this function.

proisagg

Boolean

Whether the function is an aggregate function.

proiswindow

Boolean

Whether the function is a window function.

prosecdef

Boolean

Whether the function is a security definer (for example, a setuid function).

proleakproof

Boolean

Whether the function has side effects. An error is thrown if the function does not prevent leaks on parameters.

proisstrict

Boolean

Whether the function returns null if any parameter is null. In this case, the function is not called. Non-strict functions must handle null inputs.

proretset

Boolean

Whether the function returns a set (that is, multiple values of a specified data type).

provolatile

"char"

Whether the function's results only depend on its input parameters or can also be affected by external factors. Options:

  • i indicates an immutable function, consistently producing the same output for identical inputs.
  • s indicates a stable function whose results remain constant within a single scan for fixed inputs.
  • v indicates a volatile function whose results may vary unpredictably over time.

pronargs

smallint

Count of parameters.

pronargdefaults

smallint

Number of parameters with default values.

prorettype

oid

OID of the returned parameter type.

proargtypes

oidvector

An array of data types of function parameters. It includes only input parameters (including INOUT parameters), thus reflecting the function's calling characteristics.

proallargtypes

oid[]

An array of data types of function parameters. It includes all parameter types (including OUT and INOUT parameters). If all parameters are IN parameters, this column is null. Note that the array index starts at 1, while historically, proargtypes starts at 0.

proargmodes

"char"[]

An array of function parameter modes. Options:

  • i indicates IN parameters.
  • o indicates OUT parameters.
  • b indicates INOUT parameters.

If all the parameters are IN parameters, this column is null. Note that this array index corresponds to the positions in proallargtypes rather than proargtypes.

proargnames

text[]

An array of function parameter names. Unnamed parameters are represented by empty strings in the array. If no parameters have names, this column is null. Note that this array index corresponds to proallargtypes rather than proargtypes.

proargdefaults

pg_node_tree

Expression tree of default values. It is a list of PRONARGDEFAULTS elements.

prosrc

text

Definition of a function or stored procedure. For example, for interpreted languages, it could be the source code of the function, a linking symbol, a file name, or any other function body content specified during creation, depending on the language/calling convention implementation.

probin

text

Additional information on how to call the function. Its meaning is also language-dependent.

proconfig

text[]

Local settings for runtime configuration variables within the function.

proacl

aclitem[]

Access permissions. For details, see GRANT and REVOKE.

prodefaultargpos

int2vector

Positions of function defaults, not restricted to being available only for the last few parameters.

fencedmode

Boolean

Function execution mode, indicating whether the function runs in fence or not fence mode. In fence mode, the function executes in a newly forked process. The default value is fence.

proshippable

Boolean

Whether the function can be pushed down to DNs for execution. The default value is false.

  • Functions of IMMUTABLE type can always be pushed down to DNs for execution.
  • STABLE or VOLATILE functions can be pushed down to DNs only when their attribute is SHIPPABLE.

propackage

Boolean

Whether the function supports overloading, primarily targeting Oracle-style functions. The default value is false.

Examples

Retrieve the OID of a specific function. For example, get the OID of the justify_days function which is 1295.

1
2
3
4
5
SELECT oid FROM pg_proc where proname ='justify_days';
 oid
------
 1295
(1 row)

Check whether a specific function is an aggregate function. For example, verify that the justify_days function is not an aggregate function.

1
2
3
4
5
SELECT proisagg FROM pg_proc where proname ='justify_days';
 proisagg
----------
 f
(1 row)