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