PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_proc.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_proc.h
4 * definition of the "procedure" system catalog (pg_proc)
5 *
6 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/catalog/pg_proc.h
10 *
11 * NOTES
12 * The Catalog.pm module reads this file and derives schema
13 * information.
14 *
15 *-------------------------------------------------------------------------
16 */
17#ifndef PG_PROC_H
18#define PG_PROC_H
19
20#include "catalog/genbki.h"
22#include "catalog/pg_proc_d.h" /* IWYU pragma: export */
23#include "nodes/pg_list.h"
24
25/* ----------------
26 * pg_proc definition. cpp turns this into
27 * typedef struct FormData_pg_proc
28 * ----------------
29 */
31
33{
34 Oid oid; /* oid */
35
36 /* procedure name */
38
39 /* OID of namespace containing this proc */
41
42 /* procedure owner */
44
45 /* OID of pg_language entry */
47
48 /* estimated execution cost */
50
51 /* estimated # of rows out (if proretset) */
53
54 /* element type of variadic array, or 0 if not variadic */
56
57 /* planner support function for this function, or 0 if none */
59
60 /* see PROKIND_ categories below */
61 char prokind BKI_DEFAULT(f);
62
63 /* security definer */
64 bool prosecdef BKI_DEFAULT(f);
65
66 /* is it a leakproof function? */
68
69 /* strict with respect to NULLs? */
71
72 /* returns a set? */
73 bool proretset BKI_DEFAULT(f);
74
75 /* see PROVOLATILE_ categories below */
77
78 /* see PROPARALLEL_ categories below */
80
81 /* number of arguments */
82 /* Note: need not be given in pg_proc.dat; genbki.pl will compute it */
84
85 /* number of arguments with defaults */
87
88 /* OID of result type */
89 Oid prorettype BKI_LOOKUP(pg_type);
90
91 /*
92 * variable-length fields start here, but we allow direct access to
93 * proargtypes
94 */
95
96 /* parameter types (excludes OUT params) */
98
99#ifdef CATALOG_VARLEN
100
101 /* all param types (NULL if IN only) */
103
104 /* parameter modes (NULL if IN only) */
106
107 /* parameter names (NULL if no names) */
109
110 /* list of expression trees for argument defaults (NULL if none) */
112
113 /* types for which to apply transforms */
115
116 /* procedure source text */
118
119 /* secondary procedure info (can be NULL) */
121
122 /* pre-parsed SQL function body */
124
125 /* procedure-local GUC settings */
127
128 /* access permissions */
130#endif
132
134
135/* ----------------
136 * Form_pg_proc corresponds to a pointer to a tuple with
137 * the format of pg_proc relation.
138 * ----------------
139 */
141
143
146
149
150#ifdef EXPOSE_TO_CLIENT_CODE
151
152/*
153 * Symbolic values for prokind column
154 */
155#define PROKIND_FUNCTION 'f'
156#define PROKIND_AGGREGATE 'a'
157#define PROKIND_WINDOW 'w'
158#define PROKIND_PROCEDURE 'p'
159
160/*
161 * Symbolic values for provolatile column: these indicate whether the result
162 * of a function is dependent *only* on the values of its explicit arguments,
163 * or can change due to outside factors (such as parameter variables or
164 * table contents). NOTE: functions having side-effects, such as setval(),
165 * must be labeled volatile to ensure they will not get optimized away,
166 * even if the actual return value is not changeable.
167 */
168#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */
169#define PROVOLATILE_STABLE 's' /* does not change within a scan */
170#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */
171
172/*
173 * Symbolic values for proparallel column: these indicate whether a function
174 * can be safely be run in a parallel backend, during parallelism but
175 * necessarily in the leader, or only in non-parallel mode.
176 */
177#define PROPARALLEL_SAFE 's' /* can run in worker or leader */
178#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel leader only */
179#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */
180
181/*
182 * Symbolic values for proargmodes column. Note that these must agree with
183 * the FunctionParameterMode enum in parsenodes.h; we declare them here to
184 * be accessible from either header.
185 */
186#define PROARGMODE_IN 'i'
187#define PROARGMODE_OUT 'o'
188#define PROARGMODE_INOUT 'b'
189#define PROARGMODE_VARIADIC 'v'
190#define PROARGMODE_TABLE 't'
191
192#endif /* EXPOSE_TO_CLIENT_CODE */
193
194
197 bool replace,
198 bool returnsSet,
199 Oid returnType,
203 const char *prosrc,
204 const char *probin,
206 char prokind,
207 bool security_definer,
208 bool isLeakProof,
209 bool isStrict,
210 char volatility,
211 char parallel,
212 oidvector *parameterTypes,
217 Datum trftypes,
218 List *trfoids,
223
224extern bool function_parse_error_transpose(const char *prosrc);
225
226extern List *oid_array_to_list(Datum datum);
227
228#endif /* PG_PROC_H */
Oid regproc
Definition c.h:675
int16_t int16
Definition c.h:553
float float4
Definition c.h:655
#define BEGIN_CATALOG_STRUCT
Definition genbki.h:37
#define DECLARE_UNIQUE_INDEX_PKEY(name, oid, oidmacro, tblname, decl)
Definition genbki.h:105
#define BKI_LOOKUP(catalog)
Definition genbki.h:65
#define END_CATALOG_STRUCT
Definition genbki.h:38
#define BKI_DEFAULT(value)
Definition genbki.h:54
#define BKI_LOOKUP_OPT(catalog)
Definition genbki.h:66
#define DECLARE_UNIQUE_INDEX(name, oid, oidmacro, tblname, decl)
Definition genbki.h:104
#define BKI_FORCE_NOT_NULL
Definition genbki.h:52
#define DECLARE_TOAST(name, toastoid, indexoid)
Definition genbki.h:82
#define CATALOG(name, oid, oidmacro)
Definition genbki.h:42
#define BKI_BOOTSTRAP
Definition genbki.h:45
#define MAKE_SYSCACHE(name, idxname, nbuckets)
Definition genbki.h:146
#define BKI_ROWTYPE_OID(oid, oidmacro)
Definition genbki.h:47
int i
Definition isn.c:77
ObjectAddress ProcedureCreate(const char *procedureName, Oid procNamespace, bool replace, bool returnsSet, Oid returnType, Oid proowner, Oid languageObjectId, Oid languageValidator, const char *prosrc, const char *probin, Node *prosqlbody, char prokind, bool security_definer, bool isLeakProof, bool isStrict, char volatility, char parallel, oidvector *parameterTypes, Datum allParameterTypes, Datum parameterModes, Datum parameterNames, List *parameterDefaults, Datum trftypes, List *trfoids, Datum proconfig, Oid prosupport, float4 procost, float4 prorows)
Definition pg_proc.c:99
FormData_pg_proc
Definition pg_proc.h:131
List * oid_array_to_list(Datum datum)
Definition pg_proc.c:1230
int16 pronargs
Definition pg_proc.h:83
bool function_parse_error_transpose(const char *prosrc)
Definition pg_proc.c:1048
END_CATALOG_STRUCT typedef FormData_pg_proc * Form_pg_proc
Definition pg_proc.h:140
BEGIN_CATALOG_STRUCT ProcedureRelation_Rowtype_Id BKI_SCHEMA_MACRO
Definition pg_proc.h:33
NameData proname
Definition pg_proc.h:37
uint64_t Datum
Definition postgres.h:70
unsigned int Oid
static int fb(int x)
Definition pg_list.h:54
Definition nodes.h:135
Definition c.h:772
Definition c.h:757
Definition c.h:718