PG_PROC¶
PG_PROC records information about functions or procedures.
Name | Type | Description |
---|---|---|
proname | name | Name of the function |
pronamespace | oid | OID of the namespace that contains the function |
proowner | oid | Owner of the function |
prolang | oid | Implementation language or call interface of the function |
procost | real | Estimated execution cost |
prorows | real | Estimate number of result rows |
provariadic | oid | Data type of parameter element |
protransform | regproc | Simplified call method for this function |
proisagg | boolean | Whether this function is an aggregate function |
proiswindow | boolean | Whether this function is a window function |
prosecdef | boolean | Whether this function is a security definer (such as a "setuid" function) |
proleakproof | boolean | Whether this function has side effects. If no leakproof treatment is provided for parameters, the function throws errors. |
proisstrict | boolean | The function returns null if any call parameter is null. In that case the function does not actually be called at all. Functions that are not "strict" must be prepared to process null inputs. |
proretset | boolean | The function returns a set, that is, multiple values of the specified data type. |
provolatile | "char" | Whether the function's result depends only on its input parameters, or is affected by outside factors
|
pronargs | smallint | Number of parameters |
pronargdefaults | smallint | Number of parameters that have default values |
prorettype | oid | OID of the returned parameter type |
proargtypes | oidvector | Array with the data types of the function parameters. This array includes only input parameters (including INOUT parameters) and thus represents the call signature of the function. |
proallargtypes | oid[] | Array with the data types of the function parameters. This array includes all parameter types (including OUT and INOUT parameters); however, if all the parameters are IN parameters, this column is null. Note that array subscripting is 1-based, whereas for historical reasons, and proargtypes is subscripted from 0. |
proargmodes | "char"[] | Array with the modes of the function parameters.
If all the parameters are IN parameters, this column is null. Note that subscripts of this array correspond to positions of proallargtypes not proargtypes. |
proargnames | text[] | Array that stores the names of the function parameters. Parameters without a name are set to empty strings in the array. If none of the parameters have a name, this column is null. Note that subscripts correspond to positions of proallargtypes not proargtypes. |
proargdefaults | pg_node_tree | Expression tree of the default value. This is the list of PRONARGDEFAULTS elements. |
prosrc | text | A definition that describes a function or stored procedure. In an interpreting language, it is the function source code, a link symbol, a file name, or any body content specified when a function or stored procedure is created, depending on how a language or calling is used. |
probin | text | Additional information about how to call the function. Again, the interpretation is language-specific. |
proconfig | text[] | Function's local settings for run-time configuration variables. |
proacl | aclitem[] | Access permissions For details, see GRANT and REVOKE. |
prodefaultargpos | int2vector | Locations of the function default values. Not only the last few parameters have default values. |
fencedmode | boolean | Execution mode of a function, indicating whether a function is executed in fence or not fence mode. If the execution mode is fence, the function is executed in the fork process that is reworked. The default value is fence. |
proshippable | boolean | Whether a function can be pushed down to DNs. The default value is false.
|
propackage | boolean | Indicates whether the function supports overloading, which is mainly used for the Oracle style function. The default value is false. |
Examples¶
Query the OID of a specified function. For example, obtain the OID 1295 of the justify_days function.
SELECT oid FROM pg_proc where proname ='justify_days';
oid
------
1295
(1 row)
Query whether a function is an aggregate function. For example, the justify_days function is a non-aggregate function.
SELECT proisagg FROM pg_proc where proname ='justify_days';
proisagg
----------
f
(1 row)