4 The catalog pg_proc stores information about functions, procedures,
5 aggregate functions, and window functions (collectively also known as
6 routines). See CREATE FUNCTION, CREATE PROCEDURE, and Section 36.3 for
9 If prokind indicates that the entry is for an aggregate function, there
10 should be a matching row in pg_aggregate.
12 Table 52.39. pg_proc Columns
26 pronamespace oid (references pg_namespace.oid)
28 The OID of the namespace that contains this function
30 proowner oid (references pg_authid.oid)
34 prolang oid (references pg_language.oid)
36 Implementation language or call interface of this function
40 Estimated execution cost (in units of cpu_operator_cost); if proretset,
41 this is cost per row returned
45 Estimated number of result rows (zero if not proretset)
47 provariadic oid (references pg_type.oid)
49 Data type of the variadic array parameter's elements, or zero if the
50 function does not have a variadic parameter
52 prosupport regproc (references pg_proc.oid)
54 Planner support function for this function (see Section 36.11), or zero
59 f for a normal function, p for a procedure, a for an aggregate
60 function, or w for a window function
64 Function is a security definer (i.e., a “setuid” function)
68 The function has no side effects. No information about the arguments is
69 conveyed except via the return value. Any function that might throw an
70 error depending on the values of its arguments is not leakproof.
74 Function returns null if any call argument is null. In that case the
75 function won't actually be called at all. Functions that are not
76 “strict” must be prepared to handle null inputs.
80 Function returns a set (i.e., multiple values of the specified data
85 provolatile tells whether the function's result depends only on its
86 input arguments, or is affected by outside factors. It is i for
87 “immutable” functions, which always deliver the same result for the
88 same inputs. It is s for “stable” functions, whose results (for fixed
89 inputs) do not change within a scan. It is v for “volatile” functions,
90 whose results might change at any time. (Use v also for functions with
91 side-effects, so that calls to them cannot get optimized away.)
95 proparallel tells whether the function can be safely run in parallel
96 mode. It is s for functions which are safe to run in parallel mode
97 without restriction. It is r for functions which can be run in parallel
98 mode, but their execution is restricted to the parallel group leader;
99 parallel worker processes cannot invoke these functions. It is u for
100 functions which are unsafe in parallel mode; the presence of such a
101 function forces a serial execution plan.
105 Number of input arguments
109 Number of arguments that have defaults
111 prorettype oid (references pg_type.oid)
113 Data type of the return value
115 proargtypes oidvector (references pg_type.oid)
117 An array of the data types of the function arguments. This includes
118 only input arguments (including INOUT and VARIADIC arguments), and thus
119 represents the call signature of the function.
121 proallargtypes oid[] (references pg_type.oid)
123 An array of the data types of the function arguments. This includes all
124 arguments (including OUT and INOUT arguments); however, if all the
125 arguments are IN arguments, this field will be null. Note that
126 subscripting is 1-based, whereas for historical reasons proargtypes is
131 An array of the modes of the function arguments, encoded as i for IN
132 arguments, o for OUT arguments, b for INOUT arguments, v for VARIADIC
133 arguments, t for TABLE arguments. If all the arguments are IN
134 arguments, this field will be null. Note that subscripts correspond to
135 positions of proallargtypes not proargtypes.
139 An array of the names of the function arguments. Arguments without a
140 name are set to empty strings in the array. If none of the arguments
141 have a name, this field will be null. Note that subscripts correspond
142 to positions of proallargtypes not proargtypes.
144 proargdefaults pg_node_tree
146 Expression trees (in nodeToString() representation) for default values.
147 This is a list with pronargdefaults elements, corresponding to the last
148 N input arguments (i.e., the last N proargtypes positions). If none of
149 the arguments have defaults, this field will be null.
151 protrftypes oid[] (references pg_type.oid)
153 An array of the argument/result data type(s) for which to apply
154 transforms (from the function's TRANSFORM clause). Null if none.
158 This tells the function handler how to invoke the function. It might be
159 the actual source code of the function for interpreted languages, a
160 link symbol, a file name, or just about anything else, depending on the
161 implementation language/call convention.
165 Additional information about how to invoke the function. Again, the
166 interpretation is language-specific.
168 prosqlbody pg_node_tree
170 Pre-parsed SQL function body. This is used for SQL-language functions
171 when the body is given in SQL-standard notation rather than as a string
172 literal. It's null in other cases.
176 Function's local settings for run-time configuration variables
180 Access privileges; see Section 5.8 for details
182 For compiled functions, both built-in and dynamically loaded, prosrc
183 contains the function's C-language name (link symbol). For SQL-language
184 functions, prosrc contains the function's source text if that is
185 specified as a string literal; but if the function body is specified in
186 SQL-standard style, prosrc is unused (typically it's an empty string)
187 and prosqlbody contains the pre-parsed definition. For all other
188 currently-known language types, prosrc contains the function's source
189 text. probin is null except for dynamically-loaded C functions, for
190 which it gives the name of the shared library file containing the