1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>53.39. pg_proc</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-policy.html" title="53.38. pg_policy" /><link rel="next" href="catalog-pg-publication.html" title="53.40. pg_publication" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.39. <code class="structname">pg_proc</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-policy.html" title="53.38. pg_policy">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 53. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-publication.html" title="53.40. pg_publication">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-PROC"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.39. <code class="structname">pg_proc</code></h2></div></div></div><a id="id-1.10.4.41.2" class="indexterm"></a><p>
The catalog <code class="structname">pg_proc</code> stores information about
functions, procedures, aggregate functions, and window functions
(collectively also known as routines). See <a class="xref" href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle">CREATE FUNCTION</span></a>, <a class="xref" href="sql-createprocedure.html" title="CREATE PROCEDURE"><span class="refentrytitle">CREATE PROCEDURE</span></a>, and
<a class="xref" href="xfunc.html" title="38.3. User-Defined Functions">Section 38.3</a> for more information.
</p><p>
If <code class="structfield">prokind</code> indicates that the entry is for an
aggregate function, there should be a matching row in
<a class="link" href="catalog-pg-aggregate.html" title="53.2. pg_aggregate"><code class="structfield">pg_aggregate</code></a>.
</p><div class="table" id="id-1.10.4.41.5"><p class="title"><strong>Table 53.39. <code class="structname">pg_proc</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_proc Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
Column Type
</p>
<p>
Description
</p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">oid</code> <code class="type">oid</code>
</p>
<p>
Row identifier
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proname</code> <code class="type">name</code>
</p>
<p>
Name of the function
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">pronamespace</code> <code class="type">oid</code>
(references <a class="link" href="catalog-pg-namespace.html" title="53.32. pg_namespace"><code class="structname">pg_namespace</code></a>.<code class="structfield">oid</code>)
</p>
<p>
The OID of the namespace that contains this function
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proowner</code> <code class="type">oid</code>
(references <a class="link" href="catalog-pg-authid.html" title="53.8. pg_authid"><code class="structname">pg_authid</code></a>.<code class="structfield">oid</code>)
</p>
<p>
Owner of the function
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prolang</code> <code class="type">oid</code>
(references <a class="link" href="catalog-pg-language.html" title="53.29. pg_language"><code class="structname">pg_language</code></a>.<code class="structfield">oid</code>)
</p>
<p>
Implementation language or call interface of this function
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">procost</code> <code class="type">float4</code>
</p>
<p>
Estimated execution cost (in units of
<a class="xref" href="runtime-config-query.html#GUC-CPU-OPERATOR-COST">cpu_operator_cost</a>); if <code class="structfield">proretset</code>,
this is cost per row returned
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prorows</code> <code class="type">float4</code>
</p>
<p>
Estimated number of result rows (zero if not <code class="structfield">proretset</code>)
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">provariadic</code> <code class="type">oid</code>
(references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
</p>
<p>
Data type of the variadic array parameter's elements,
or zero if the function does not have a variadic parameter
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prosupport</code> <code class="type">regproc</code>
(references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
</p>
<p>
Planner support function for this function
(see <a class="xref" href="xfunc-optimization.html" title="38.11. Function Optimization Information">Section 38.11</a>), or zero if none
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prokind</code> <code class="type">char</code>
</p>
<p>
<code class="literal">f</code> for a normal function, <code class="literal">p</code>
for a procedure, <code class="literal">a</code> for an aggregate function, or
<code class="literal">w</code> for a window function
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prosecdef</code> <code class="type">bool</code>
</p>
<p>
Function is a security definer (i.e., a <span class="quote">“<span class="quote">setuid</span>”</span>
function)
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proleakproof</code> <code class="type">bool</code>
</p>
<p>
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.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proisstrict</code> <code class="type">bool</code>
</p>
<p>
Function returns null if any call argument is null. In that
case the function won't actually be called at all. Functions
that are not <span class="quote">“<span class="quote">strict</span>”</span> must be prepared to handle
null inputs.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proretset</code> <code class="type">bool</code>
</p>
<p>
Function returns a set (i.e., multiple values of the specified
data type)
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">provolatile</code> <code class="type">char</code>
</p>
<p>
<code class="structfield">provolatile</code> tells whether the function's
result depends only on its input arguments, or is affected by outside
factors.
It is <code class="literal">i</code> for <span class="quote">“<span class="quote">immutable</span>”</span> functions,
which always deliver the same result for the same inputs.
It is <code class="literal">s</code> for <span class="quote">“<span class="quote">stable</span>”</span> functions,
whose results (for fixed inputs) do not change within a scan.
It is <code class="literal">v</code> for <span class="quote">“<span class="quote">volatile</span>”</span> functions,
whose results might change at any time. (Use <code class="literal">v</code> also
for functions with side-effects, so that calls to them cannot get
optimized away.)
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proparallel</code> <code class="type">char</code>
</p>
<p>
<code class="structfield">proparallel</code> tells whether the function
can be safely run in parallel mode.
It is <code class="literal">s</code> for functions which are safe to run in
parallel mode without restriction.
It is <code class="literal">r</code> 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 <code class="literal">u</code> for functions which are unsafe in parallel
mode; the presence of such a function forces a serial execution plan.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">pronargs</code> <code class="type">int2</code>
</p>
<p>
Number of input arguments
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">pronargdefaults</code> <code class="type">int2</code>
</p>
<p>
Number of arguments that have defaults
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prorettype</code> <code class="type">oid</code>
(references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
</p>
<p>
Data type of the return value
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proargtypes</code> <code class="type">oidvector</code>
(references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
</p>
<p>
An array of the data types of the function arguments. This includes
only input arguments (including <code class="literal">INOUT</code> and
<code class="literal">VARIADIC</code> arguments), and thus represents
the call signature of the function.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proallargtypes</code> <code class="type">oid[]</code>
(references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
</p>
<p>
An array of the data types of the function arguments. This includes
all arguments (including <code class="literal">OUT</code> and
<code class="literal">INOUT</code> arguments); however, if all the
arguments are <code class="literal">IN</code> arguments, this field will be null.
Note that subscripting is 1-based, whereas for historical reasons
<code class="structfield">proargtypes</code> is subscripted from 0.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proargmodes</code> <code class="type">char[]</code>
</p>
<p>
An array of the modes of the function arguments, encoded as
<code class="literal">i</code> for <code class="literal">IN</code> arguments,
<code class="literal">o</code> for <code class="literal">OUT</code> arguments,
<code class="literal">b</code> for <code class="literal">INOUT</code> arguments,
<code class="literal">v</code> for <code class="literal">VARIADIC</code> arguments,
<code class="literal">t</code> for <code class="literal">TABLE</code> arguments.
If all the arguments are <code class="literal">IN</code> arguments,
this field will be null.
Note that subscripts correspond to positions of
<code class="structfield">proallargtypes</code> not <code class="structfield">proargtypes</code>.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proargnames</code> <code class="type">text[]</code>
</p>
<p>
An 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
<code class="structfield">proallargtypes</code> not <code class="structfield">proargtypes</code>.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proargdefaults</code> <code class="type">pg_node_tree</code>
</p>
<p>
Expression trees (in <code class="function">nodeToString()</code> representation)
for default values. This is a list with
<code class="structfield">pronargdefaults</code> elements, corresponding to the last
<em class="replaceable"><code>N</code></em> <span class="emphasis"><em>input</em></span> arguments (i.e., the last
<em class="replaceable"><code>N</code></em> <code class="structfield">proargtypes</code> positions).
If none of the arguments have defaults, this field will be null.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">protrftypes</code> <code class="type">oid[]</code>
(references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
</p>
<p>
An array of the argument/result data type(s) for which to apply
transforms (from the function's <code class="literal">TRANSFORM</code>
clause). Null if none.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prosrc</code> <code class="type">text</code>
</p>
<p>
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.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">probin</code> <code class="type">text</code>
</p>
<p>
Additional information about how to invoke the function.
Again, the interpretation is language-specific.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">prosqlbody</code> <code class="type">pg_node_tree</code>
</p>
<p>
Pre-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.
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proconfig</code> <code class="type">text[]</code>
</p>
<p>
Function's local settings for run-time configuration variables
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">proacl</code> <code class="type">aclitem[]</code>
</p>
<p>
Access privileges; see <a class="xref" href="ddl-priv.html" title="5.7. Privileges">Section 5.7</a> for details
</p></td></tr></tbody></table></div></div><br class="table-break" /><p>
For compiled functions, both built-in and dynamically loaded,
<code class="structfield">prosrc</code> contains the function's C-language
name (link symbol).
For SQL-language functions, <code class="structfield">prosrc</code> contains
the function's source text if that is specified as a string literal;
but if the function body is specified in SQL-standard style,
<code class="structfield">prosrc</code> is unused (typically it's an empty
string) and <code class="structfield">prosqlbody</code> contains the
pre-parsed definition.
For all other currently-known language types,
<code class="structfield">prosrc</code> contains the function's source
text. <code class="structfield">probin</code> is null except for
dynamically-loaded C functions, for which it gives the name of the
shared library file containing the function.
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-policy.html" title="53.38. pg_policy">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-publication.html" title="53.40. pg_publication">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.38. <code class="structname">pg_policy</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.40. <code class="structname">pg_publication</code></td></tr></table></div></body></html>
|