PostgreSQL Source Code  git master
fmgr.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * fmgr.h
4  * Definitions for the Postgres function manager and function-call
5  * interface.
6  *
7  * This file must be included by all Postgres modules that either define
8  * or call fmgr-callable functions.
9  *
10  *
11  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
12  * Portions Copyright (c) 1994, Regents of the University of California
13  *
14  * src/include/fmgr.h
15  *
16  *-------------------------------------------------------------------------
17  */
18 #ifndef FMGR_H
19 #define FMGR_H
20 
21 /* We don't want to include primnodes.h here, so make some stub references */
22 typedef struct Node *fmNodePtr;
23 typedef struct Aggref *fmAggrefPtr;
24 
25 /* Likewise, avoid including execnodes.h here */
27 
28 /* Likewise, avoid including stringinfo.h here */
29 typedef struct StringInfoData *fmStringInfo;
30 
31 
32 /*
33  * All functions that can be called directly by fmgr must have this signature.
34  * (Other functions can be called by using a handler that does have this
35  * signature.)
36  */
37 
39 
40 typedef Datum (*PGFunction) (FunctionCallInfo fcinfo);
41 
42 /*
43  * This struct holds the system-catalog information that must be looked up
44  * before a function can be called through fmgr. If the same function is
45  * to be called multiple times, the lookup need be done only once and the
46  * info struct saved for re-use.
47  *
48  * Note that fn_expr really is parse-time-determined information about the
49  * arguments, rather than about the function itself. But it's convenient
50  * to store it here rather than in FunctionCallInfoData, where it might more
51  * logically belong.
52  *
53  * fn_extra is available for use by the called function; all other fields
54  * should be treated as read-only after the struct is created.
55  */
56 typedef struct FmgrInfo
57 {
58  PGFunction fn_addr; /* pointer to function or handler to be called */
59  Oid fn_oid; /* OID of function (NOT of handler, if any) */
60  short fn_nargs; /* number of input args (0..FUNC_MAX_ARGS) */
61  bool fn_strict; /* function is "strict" (NULL in => NULL out) */
62  bool fn_retset; /* function returns a set */
63  unsigned char fn_stats; /* collect stats if track_functions > this */
64  void *fn_extra; /* extra space for use by handler */
65  MemoryContext fn_mcxt; /* memory context to store fn_extra in */
66  fmNodePtr fn_expr; /* expression parse tree for call, or NULL */
67 } FmgrInfo;
68 
69 /*
70  * This struct is the data actually passed to an fmgr-called function.
71  *
72  * The called function is expected to set isnull, and possibly resultinfo or
73  * fields in whatever resultinfo points to. It should not change any other
74  * fields. (In particular, scribbling on the argument arrays is a bad idea,
75  * since some callers assume they can re-call with the same arguments.)
76  */
77 typedef struct FunctionCallInfoData
78 {
79  FmgrInfo *flinfo; /* ptr to lookup info used for this call */
80  fmNodePtr context; /* pass info about context of call */
81  fmNodePtr resultinfo; /* pass or return extra info about result */
82  Oid fncollation; /* collation for function to use */
83  bool isnull; /* function must set true if result is NULL */
84  short nargs; /* # arguments actually passed */
85  Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */
86  bool argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */
88 
89 /*
90  * This routine fills a FmgrInfo struct, given the OID
91  * of the function to be called.
92  */
93 extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
94 
95 /*
96  * Same, when the FmgrInfo struct is in a memory context longer-lived than
97  * CurrentMemoryContext. The specified context will be set as fn_mcxt
98  * and used to hold all subsidiary data of finfo.
99  */
100 extern void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo,
101  MemoryContext mcxt);
102 
103 /* Convenience macro for setting the fn_expr field */
104 #define fmgr_info_set_expr(expr, finfo) \
105  ((finfo)->fn_expr = (expr))
106 
107 /*
108  * Copy an FmgrInfo struct
109  */
110 extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
111  MemoryContext destcxt);
112 
113 /*
114  * This macro initializes all the fields of a FunctionCallInfoData except
115  * for the arg[] and argnull[] arrays. Performance testing has shown that
116  * the fastest way to set up argnull[] for small numbers of arguments is to
117  * explicitly set each required element to false, so we don't try to zero
118  * out the argnull[] array in the macro.
119  */
120 #define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo) \
121  do { \
122  (Fcinfo).flinfo = (Flinfo); \
123  (Fcinfo).context = (Context); \
124  (Fcinfo).resultinfo = (Resultinfo); \
125  (Fcinfo).fncollation = (Collation); \
126  (Fcinfo).isnull = false; \
127  (Fcinfo).nargs = (Nargs); \
128  } while (0)
129 
130 /*
131  * This macro invokes a function given a filled-in FunctionCallInfoData
132  * struct. The macro result is the returned Datum --- but note that
133  * caller must still check fcinfo->isnull! Also, if function is strict,
134  * it is caller's responsibility to verify that no null arguments are present
135  * before calling.
136  */
137 #define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo))
138 
139 
140 /*-------------------------------------------------------------------------
141  * Support macros to ease writing fmgr-compatible functions
142  *
143  * A C-coded fmgr-compatible function should be declared as
144  *
145  * Datum
146  * function_name(PG_FUNCTION_ARGS)
147  * {
148  * ...
149  * }
150  *
151  * It should access its arguments using appropriate PG_GETARG_xxx macros
152  * and should return its result using PG_RETURN_xxx.
153  *
154  *-------------------------------------------------------------------------
155  */
156 
157 /* Standard parameter list for fmgr-compatible functions */
158 #define PG_FUNCTION_ARGS FunctionCallInfo fcinfo
159 
160 /*
161  * Get collation function should use.
162  */
163 #define PG_GET_COLLATION() (fcinfo->fncollation)
164 
165 /*
166  * Get number of arguments passed to function.
167  */
168 #define PG_NARGS() (fcinfo->nargs)
169 
170 /*
171  * If function is not marked "proisstrict" in pg_proc, it must check for
172  * null arguments using this macro. Do not try to GETARG a null argument!
173  */
174 #define PG_ARGISNULL(n) (fcinfo->argnull[n])
175 
176 /*
177  * Support for fetching detoasted copies of toastable datatypes (all of
178  * which are varlena types). pg_detoast_datum() gives you either the input
179  * datum (if not toasted) or a detoasted copy allocated with palloc().
180  * pg_detoast_datum_copy() always gives you a palloc'd copy --- use it
181  * if you need a modifiable copy of the input. Caller is expected to have
182  * checked for null inputs first, if necessary.
183  *
184  * pg_detoast_datum_packed() will return packed (1-byte header) datums
185  * unmodified. It will still expand an externally toasted or compressed datum.
186  * The resulting datum can be accessed using VARSIZE_ANY() and VARDATA_ANY()
187  * (beware of multiple evaluations in those macros!)
188  *
189  * In consumers oblivious to data alignment, call PG_DETOAST_DATUM_PACKED(),
190  * VARDATA_ANY(), VARSIZE_ANY() and VARSIZE_ANY_EXHDR(). Elsewhere, call
191  * PG_DETOAST_DATUM(), VARDATA() and VARSIZE(). Directly fetching an int16,
192  * int32 or wider field in the struct representing the datum layout requires
193  * aligned data. memcpy() is alignment-oblivious, as are most operations on
194  * datatypes, such as text, whose layout struct contains only char fields.
195  *
196  * Note: it'd be nice if these could be macros, but I see no way to do that
197  * without evaluating the arguments multiple times, which is NOT acceptable.
198  */
199 extern struct varlena *pg_detoast_datum(struct varlena *datum);
200 extern struct varlena *pg_detoast_datum_copy(struct varlena *datum);
201 extern struct varlena *pg_detoast_datum_slice(struct varlena *datum,
202  int32 first, int32 count);
203 extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
204 
205 #define PG_DETOAST_DATUM(datum) \
206  pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
207 #define PG_DETOAST_DATUM_COPY(datum) \
208  pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
209 #define PG_DETOAST_DATUM_SLICE(datum,f,c) \
210  pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
211  (int32) (f), (int32) (c))
212 /* WARNING -- unaligned pointer */
213 #define PG_DETOAST_DATUM_PACKED(datum) \
214  pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
215 
216 /*
217  * Support for cleaning up detoasted copies of inputs. This must only
218  * be used for pass-by-ref datatypes, and normally would only be used
219  * for toastable types. If the given pointer is different from the
220  * original argument, assume it's a palloc'd detoasted copy, and pfree it.
221  * NOTE: most functions on toastable types do not have to worry about this,
222  * but we currently require that support functions for indexes not leak
223  * memory.
224  */
225 #define PG_FREE_IF_COPY(ptr,n) \
226  do { \
227  if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
228  pfree(ptr); \
229  } while (0)
230 
231 /* Macros for fetching arguments of standard types */
232 
233 #define PG_GETARG_DATUM(n) (fcinfo->arg[n])
234 #define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n))
235 #define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n))
236 #define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n))
237 #define PG_GETARG_UINT16(n) DatumGetUInt16(PG_GETARG_DATUM(n))
238 #define PG_GETARG_CHAR(n) DatumGetChar(PG_GETARG_DATUM(n))
239 #define PG_GETARG_BOOL(n) DatumGetBool(PG_GETARG_DATUM(n))
240 #define PG_GETARG_OID(n) DatumGetObjectId(PG_GETARG_DATUM(n))
241 #define PG_GETARG_POINTER(n) DatumGetPointer(PG_GETARG_DATUM(n))
242 #define PG_GETARG_CSTRING(n) DatumGetCString(PG_GETARG_DATUM(n))
243 #define PG_GETARG_NAME(n) DatumGetName(PG_GETARG_DATUM(n))
244 /* these macros hide the pass-by-reference-ness of the datatype: */
245 #define PG_GETARG_FLOAT4(n) DatumGetFloat4(PG_GETARG_DATUM(n))
246 #define PG_GETARG_FLOAT8(n) DatumGetFloat8(PG_GETARG_DATUM(n))
247 #define PG_GETARG_INT64(n) DatumGetInt64(PG_GETARG_DATUM(n))
248 /* use this if you want the raw, possibly-toasted input datum: */
249 #define PG_GETARG_RAW_VARLENA_P(n) ((struct varlena *) PG_GETARG_POINTER(n))
250 /* use this if you want the input datum de-toasted: */
251 #define PG_GETARG_VARLENA_P(n) PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
252 /* and this if you can handle 1-byte-header datums: */
253 #define PG_GETARG_VARLENA_PP(n) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
254 /* DatumGetFoo macros for varlena types will typically look like this: */
255 #define DatumGetByteaPP(X) ((bytea *) PG_DETOAST_DATUM_PACKED(X))
256 #define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X))
257 #define DatumGetBpCharPP(X) ((BpChar *) PG_DETOAST_DATUM_PACKED(X))
258 #define DatumGetVarCharPP(X) ((VarChar *) PG_DETOAST_DATUM_PACKED(X))
259 #define DatumGetHeapTupleHeader(X) ((HeapTupleHeader) PG_DETOAST_DATUM(X))
260 /* And we also offer variants that return an OK-to-write copy */
261 #define DatumGetByteaPCopy(X) ((bytea *) PG_DETOAST_DATUM_COPY(X))
262 #define DatumGetTextPCopy(X) ((text *) PG_DETOAST_DATUM_COPY(X))
263 #define DatumGetBpCharPCopy(X) ((BpChar *) PG_DETOAST_DATUM_COPY(X))
264 #define DatumGetVarCharPCopy(X) ((VarChar *) PG_DETOAST_DATUM_COPY(X))
265 #define DatumGetHeapTupleHeaderCopy(X) ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
266 /* Variants which return n bytes starting at pos. m */
267 #define DatumGetByteaPSlice(X,m,n) ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
268 #define DatumGetTextPSlice(X,m,n) ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
269 #define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
270 #define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
271 /* GETARG macros for varlena types will typically look like this: */
272 #define PG_GETARG_BYTEA_PP(n) DatumGetByteaPP(PG_GETARG_DATUM(n))
273 #define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n))
274 #define PG_GETARG_BPCHAR_PP(n) DatumGetBpCharPP(PG_GETARG_DATUM(n))
275 #define PG_GETARG_VARCHAR_PP(n) DatumGetVarCharPP(PG_GETARG_DATUM(n))
276 #define PG_GETARG_HEAPTUPLEHEADER(n) DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
277 /* And we also offer variants that return an OK-to-write copy */
278 #define PG_GETARG_BYTEA_P_COPY(n) DatumGetByteaPCopy(PG_GETARG_DATUM(n))
279 #define PG_GETARG_TEXT_P_COPY(n) DatumGetTextPCopy(PG_GETARG_DATUM(n))
280 #define PG_GETARG_BPCHAR_P_COPY(n) DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
281 #define PG_GETARG_VARCHAR_P_COPY(n) DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
282 #define PG_GETARG_HEAPTUPLEHEADER_COPY(n) DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
283 /* And a b-byte slice from position a -also OK to write */
284 #define PG_GETARG_BYTEA_P_SLICE(n,a,b) DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
285 #define PG_GETARG_TEXT_P_SLICE(n,a,b) DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
286 #define PG_GETARG_BPCHAR_P_SLICE(n,a,b) DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
287 #define PG_GETARG_VARCHAR_P_SLICE(n,a,b) DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
288 /*
289  * Obsolescent variants that guarantee INT alignment for the return value.
290  * Few operations on these particular types need alignment, mainly operations
291  * that cast the VARDATA pointer to a type like int16[]. Most code should use
292  * the ...PP(X) counterpart. Nonetheless, these appear frequently in code
293  * predating the PostgreSQL 8.3 introduction of the ...PP(X) variants.
294  */
295 #define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X))
296 #define DatumGetTextP(X) ((text *) PG_DETOAST_DATUM(X))
297 #define DatumGetBpCharP(X) ((BpChar *) PG_DETOAST_DATUM(X))
298 #define DatumGetVarCharP(X) ((VarChar *) PG_DETOAST_DATUM(X))
299 #define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n))
300 #define PG_GETARG_TEXT_P(n) DatumGetTextP(PG_GETARG_DATUM(n))
301 #define PG_GETARG_BPCHAR_P(n) DatumGetBpCharP(PG_GETARG_DATUM(n))
302 #define PG_GETARG_VARCHAR_P(n) DatumGetVarCharP(PG_GETARG_DATUM(n))
303 
304 /* To return a NULL do this: */
305 #define PG_RETURN_NULL() \
306  do { fcinfo->isnull = true; return (Datum) 0; } while (0)
307 
308 /* A few internal functions return void (which is not the same as NULL!) */
309 #define PG_RETURN_VOID() return (Datum) 0
310 
311 /* Macros for returning results of standard types */
312 
313 #define PG_RETURN_DATUM(x) return (x)
314 #define PG_RETURN_INT32(x) return Int32GetDatum(x)
315 #define PG_RETURN_UINT32(x) return UInt32GetDatum(x)
316 #define PG_RETURN_INT16(x) return Int16GetDatum(x)
317 #define PG_RETURN_UINT16(x) return UInt16GetDatum(x)
318 #define PG_RETURN_CHAR(x) return CharGetDatum(x)
319 #define PG_RETURN_BOOL(x) return BoolGetDatum(x)
320 #define PG_RETURN_OID(x) return ObjectIdGetDatum(x)
321 #define PG_RETURN_POINTER(x) return PointerGetDatum(x)
322 #define PG_RETURN_CSTRING(x) return CStringGetDatum(x)
323 #define PG_RETURN_NAME(x) return NameGetDatum(x)
324 /* these macros hide the pass-by-reference-ness of the datatype: */
325 #define PG_RETURN_FLOAT4(x) return Float4GetDatum(x)
326 #define PG_RETURN_FLOAT8(x) return Float8GetDatum(x)
327 #define PG_RETURN_INT64(x) return Int64GetDatum(x)
328 #define PG_RETURN_UINT64(x) return UInt64GetDatum(x)
329 /* RETURN macros for other pass-by-ref types will typically look like this: */
330 #define PG_RETURN_BYTEA_P(x) PG_RETURN_POINTER(x)
331 #define PG_RETURN_TEXT_P(x) PG_RETURN_POINTER(x)
332 #define PG_RETURN_BPCHAR_P(x) PG_RETURN_POINTER(x)
333 #define PG_RETURN_VARCHAR_P(x) PG_RETURN_POINTER(x)
334 #define PG_RETURN_HEAPTUPLEHEADER(x) return HeapTupleHeaderGetDatum(x)
335 
336 
337 /*-------------------------------------------------------------------------
338  * Support for detecting call convention of dynamically-loaded functions
339  *
340  * Dynamically loaded functions currently can only use the version-1 ("new
341  * style") calling convention. Version-0 ("old style") is not supported
342  * anymore. Version 1 is the call convention defined in this header file, and
343  * must be accompanied by the macro call
344  *
345  * PG_FUNCTION_INFO_V1(function_name);
346  *
347  * Note that internal functions do not need this decoration since they are
348  * assumed to be version-1.
349  *
350  *-------------------------------------------------------------------------
351  */
352 
353 typedef struct
354 {
355  int api_version; /* specifies call convention version number */
356  /* More fields may be added later, for version numbers > 1. */
358 
359 /* Expected signature of an info function */
360 typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
361 
362 /*
363  * Macro to build an info function associated with the given function name.
364  *
365  * As a convenience, also provide an "extern" declaration for the given
366  * function name, so that writers of C functions need not write that too.
367  *
368  * On Windows, the function and info function must be exported. Our normal
369  * build processes take care of that via .DEF files or --export-all-symbols.
370  * Module authors using a different build process might need to manually
371  * declare the function PGDLLEXPORT. We do that automatically here for the
372  * info function, since authors shouldn't need to be explicitly aware of it.
373  */
374 #define PG_FUNCTION_INFO_V1(funcname) \
375 extern Datum funcname(PG_FUNCTION_ARGS); \
376 extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
377 const Pg_finfo_record * \
378 CppConcat(pg_finfo_,funcname) (void) \
379 { \
380  static const Pg_finfo_record my_finfo = { 1 }; \
381  return &my_finfo; \
382 } \
383 extern int no_such_variable
384 
385 
386 /*-------------------------------------------------------------------------
387  * Support for verifying backend compatibility of loaded modules
388  *
389  * We require dynamically-loaded modules to include the macro call
390  * PG_MODULE_MAGIC;
391  * so that we can check for obvious incompatibility, such as being compiled
392  * for a different major PostgreSQL version.
393  *
394  * To compile with versions of PostgreSQL that do not support this,
395  * you may put an #ifdef/#endif test around it. Note that in a multiple-
396  * source-file module, the macro call should only appear once.
397  *
398  * The specific items included in the magic block are intended to be ones that
399  * are custom-configurable and especially likely to break dynamically loaded
400  * modules if they were compiled with other values. Also, the length field
401  * can be used to detect definition changes.
402  *
403  * Note: we compare magic blocks with memcmp(), so there had better not be
404  * any alignment pad bytes in them.
405  *
406  * Note: when changing the contents of magic blocks, be sure to adjust the
407  * incompatible_module_error() function in dfmgr.c.
408  *-------------------------------------------------------------------------
409  */
410 
411 /* Definition of the magic block structure */
412 typedef struct
413 {
414  int len; /* sizeof(this struct) */
415  int version; /* PostgreSQL major version */
416  int funcmaxargs; /* FUNC_MAX_ARGS */
417  int indexmaxkeys; /* INDEX_MAX_KEYS */
418  int namedatalen; /* NAMEDATALEN */
419  int float4byval; /* FLOAT4PASSBYVAL */
420  int float8byval; /* FLOAT8PASSBYVAL */
422 
423 /* The actual data block contents */
424 #define PG_MODULE_MAGIC_DATA \
425 { \
426  sizeof(Pg_magic_struct), \
427  PG_VERSION_NUM / 100, \
428  FUNC_MAX_ARGS, \
429  INDEX_MAX_KEYS, \
430  NAMEDATALEN, \
431  FLOAT4PASSBYVAL, \
432  FLOAT8PASSBYVAL \
433 }
434 
435 /*
436  * Declare the module magic function. It needs to be a function as the dlsym
437  * in the backend is only guaranteed to work on functions, not data
438  */
439 typedef const Pg_magic_struct *(*PGModuleMagicFunction) (void);
440 
441 #define PG_MAGIC_FUNCTION_NAME Pg_magic_func
442 #define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func"
443 
444 #define PG_MODULE_MAGIC \
445 extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \
446 const Pg_magic_struct * \
447 PG_MAGIC_FUNCTION_NAME(void) \
448 { \
449  static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \
450  return &Pg_magic_data; \
451 } \
452 extern int no_such_variable
453 
454 
455 /*-------------------------------------------------------------------------
456  * Support routines and macros for callers of fmgr-compatible functions
457  *-------------------------------------------------------------------------
458  */
459 
460 /* These are for invocation of a specifically named function with a
461  * directly-computed parameter list. Note that neither arguments nor result
462  * are allowed to be NULL.
463  */
464 extern Datum DirectFunctionCall1Coll(PGFunction func, Oid collation,
465  Datum arg1);
466 extern Datum DirectFunctionCall2Coll(PGFunction func, Oid collation,
467  Datum arg1, Datum arg2);
468 extern Datum DirectFunctionCall3Coll(PGFunction func, Oid collation,
469  Datum arg1, Datum arg2,
470  Datum arg3);
471 extern Datum DirectFunctionCall4Coll(PGFunction func, Oid collation,
472  Datum arg1, Datum arg2,
473  Datum arg3, Datum arg4);
474 extern Datum DirectFunctionCall5Coll(PGFunction func, Oid collation,
475  Datum arg1, Datum arg2,
476  Datum arg3, Datum arg4, Datum arg5);
477 extern Datum DirectFunctionCall6Coll(PGFunction func, Oid collation,
478  Datum arg1, Datum arg2,
479  Datum arg3, Datum arg4, Datum arg5,
480  Datum arg6);
481 extern Datum DirectFunctionCall7Coll(PGFunction func, Oid collation,
482  Datum arg1, Datum arg2,
483  Datum arg3, Datum arg4, Datum arg5,
484  Datum arg6, Datum arg7);
485 extern Datum DirectFunctionCall8Coll(PGFunction func, Oid collation,
486  Datum arg1, Datum arg2,
487  Datum arg3, Datum arg4, Datum arg5,
488  Datum arg6, Datum arg7, Datum arg8);
489 extern Datum DirectFunctionCall9Coll(PGFunction func, Oid collation,
490  Datum arg1, Datum arg2,
491  Datum arg3, Datum arg4, Datum arg5,
492  Datum arg6, Datum arg7, Datum arg8,
493  Datum arg9);
494 
495 /*
496  * These functions work like the DirectFunctionCall functions except that
497  * they use the flinfo parameter to initialise the fcinfo for the call.
498  * It's recommended that the callee only use the fn_extra and fn_mcxt
499  * fields, as other fields will typically describe the calling function
500  * not the callee. Conversely, the calling function should not have
501  * used fn_extra, unless its use is known to be compatible with the callee's.
502  */
504  Oid collation, Datum arg1);
506  Oid collation, Datum arg1, Datum arg2);
507 
508 /* These are for invocation of a previously-looked-up function with a
509  * directly-computed parameter list. Note that neither arguments nor result
510  * are allowed to be NULL.
511  */
512 extern Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation,
513  Datum arg1);
514 extern Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation,
515  Datum arg1, Datum arg2);
516 extern Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation,
517  Datum arg1, Datum arg2,
518  Datum arg3);
519 extern Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation,
520  Datum arg1, Datum arg2,
521  Datum arg3, Datum arg4);
522 extern Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation,
523  Datum arg1, Datum arg2,
524  Datum arg3, Datum arg4, Datum arg5);
525 extern Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation,
526  Datum arg1, Datum arg2,
527  Datum arg3, Datum arg4, Datum arg5,
528  Datum arg6);
529 extern Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation,
530  Datum arg1, Datum arg2,
531  Datum arg3, Datum arg4, Datum arg5,
532  Datum arg6, Datum arg7);
533 extern Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation,
534  Datum arg1, Datum arg2,
535  Datum arg3, Datum arg4, Datum arg5,
536  Datum arg6, Datum arg7, Datum arg8);
537 extern Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation,
538  Datum arg1, Datum arg2,
539  Datum arg3, Datum arg4, Datum arg5,
540  Datum arg6, Datum arg7, Datum arg8,
541  Datum arg9);
542 
543 /* These are for invocation of a function identified by OID with a
544  * directly-computed parameter list. Note that neither arguments nor result
545  * are allowed to be NULL. These are essentially fmgr_info() followed by
546  * FunctionCallN(). If the same function is to be invoked repeatedly, do the
547  * fmgr_info() once and then use FunctionCallN().
548  */
549 extern Datum OidFunctionCall0Coll(Oid functionId, Oid collation);
550 extern Datum OidFunctionCall1Coll(Oid functionId, Oid collation,
551  Datum arg1);
552 extern Datum OidFunctionCall2Coll(Oid functionId, Oid collation,
553  Datum arg1, Datum arg2);
554 extern Datum OidFunctionCall3Coll(Oid functionId, Oid collation,
555  Datum arg1, Datum arg2,
556  Datum arg3);
557 extern Datum OidFunctionCall4Coll(Oid functionId, Oid collation,
558  Datum arg1, Datum arg2,
559  Datum arg3, Datum arg4);
560 extern Datum OidFunctionCall5Coll(Oid functionId, Oid collation,
561  Datum arg1, Datum arg2,
562  Datum arg3, Datum arg4, Datum arg5);
563 extern Datum OidFunctionCall6Coll(Oid functionId, Oid collation,
564  Datum arg1, Datum arg2,
565  Datum arg3, Datum arg4, Datum arg5,
566  Datum arg6);
567 extern Datum OidFunctionCall7Coll(Oid functionId, Oid collation,
568  Datum arg1, Datum arg2,
569  Datum arg3, Datum arg4, Datum arg5,
570  Datum arg6, Datum arg7);
571 extern Datum OidFunctionCall8Coll(Oid functionId, Oid collation,
572  Datum arg1, Datum arg2,
573  Datum arg3, Datum arg4, Datum arg5,
574  Datum arg6, Datum arg7, Datum arg8);
575 extern Datum OidFunctionCall9Coll(Oid functionId, Oid collation,
576  Datum arg1, Datum arg2,
577  Datum arg3, Datum arg4, Datum arg5,
578  Datum arg6, Datum arg7, Datum arg8,
579  Datum arg9);
580 
581 /* These macros allow the collation argument to be omitted (with a default of
582  * InvalidOid, ie, no collation). They exist mostly for backwards
583  * compatibility of source code.
584  */
585 #define DirectFunctionCall1(func, arg1) \
586  DirectFunctionCall1Coll(func, InvalidOid, arg1)
587 #define DirectFunctionCall2(func, arg1, arg2) \
588  DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)
589 #define DirectFunctionCall3(func, arg1, arg2, arg3) \
590  DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)
591 #define DirectFunctionCall4(func, arg1, arg2, arg3, arg4) \
592  DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)
593 #define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5) \
594  DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)
595 #define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6) \
596  DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
597 #define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
598  DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
599 #define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
600  DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
601 #define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
602  DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
603 #define FunctionCall1(flinfo, arg1) \
604  FunctionCall1Coll(flinfo, InvalidOid, arg1)
605 #define FunctionCall2(flinfo, arg1, arg2) \
606  FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)
607 #define FunctionCall3(flinfo, arg1, arg2, arg3) \
608  FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)
609 #define FunctionCall4(flinfo, arg1, arg2, arg3, arg4) \
610  FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)
611 #define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5) \
612  FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)
613 #define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6) \
614  FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
615 #define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
616  FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
617 #define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
618  FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
619 #define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
620  FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
621 #define OidFunctionCall0(functionId) \
622  OidFunctionCall0Coll(functionId, InvalidOid)
623 #define OidFunctionCall1(functionId, arg1) \
624  OidFunctionCall1Coll(functionId, InvalidOid, arg1)
625 #define OidFunctionCall2(functionId, arg1, arg2) \
626  OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)
627 #define OidFunctionCall3(functionId, arg1, arg2, arg3) \
628  OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)
629 #define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4) \
630  OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)
631 #define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5) \
632  OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)
633 #define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6) \
634  OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
635 #define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
636  OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
637 #define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
638  OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
639 #define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
640  OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
641 
642 
643 /* Special cases for convenient invocation of datatype I/O functions. */
644 extern Datum InputFunctionCall(FmgrInfo *flinfo, char *str,
645  Oid typioparam, int32 typmod);
646 extern Datum OidInputFunctionCall(Oid functionId, char *str,
647  Oid typioparam, int32 typmod);
648 extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val);
649 extern char *OidOutputFunctionCall(Oid functionId, Datum val);
650 extern Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf,
651  Oid typioparam, int32 typmod);
652 extern Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf,
653  Oid typioparam, int32 typmod);
654 extern bytea *SendFunctionCall(FmgrInfo *flinfo, Datum val);
655 extern bytea *OidSendFunctionCall(Oid functionId, Datum val);
656 
657 
658 /*
659  * Routines in fmgr.c
660  */
661 extern const Pg_finfo_record *fetch_finfo_record(void *filehandle, const char *funcname);
662 extern void clear_external_function_hash(void *filehandle);
663 extern Oid fmgr_internal_function(const char *proname);
664 extern Oid get_fn_expr_rettype(FmgrInfo *flinfo);
665 extern Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum);
666 extern Oid get_call_expr_argtype(fmNodePtr expr, int argnum);
667 extern bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum);
668 extern bool get_call_expr_arg_stable(fmNodePtr expr, int argnum);
669 extern bool get_fn_expr_variadic(FmgrInfo *flinfo);
670 extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid);
671 
672 /*
673  * Routines in dfmgr.c
674  */
675 extern char *Dynamic_library_path;
676 
677 extern PGFunction load_external_function(const char *filename, const char *funcname,
678  bool signalNotFound, void **filehandle);
679 extern PGFunction lookup_external_function(void *filehandle, const char *funcname);
680 extern void load_file(const char *filename, bool restricted);
681 extern void **find_rendezvous_variable(const char *varName);
682 extern Size EstimateLibraryStateSpace(void);
683 extern void SerializeLibraryState(Size maxsize, char *start_address);
684 extern void RestoreLibraryState(char *start_address);
685 
686 /*
687  * Support for aggregate functions
688  *
689  * These are actually in executor/nodeAgg.c, but we declare them here since
690  * the whole point is for callers to not be overly friendly with nodeAgg.
691  */
692 
693 /* AggCheckCallContext can return one of the following codes, or 0: */
694 #define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */
695 #define AGG_CONTEXT_WINDOW 2 /* window function */
696 
697 extern int AggCheckCallContext(FunctionCallInfo fcinfo,
698  MemoryContext *aggcontext);
699 extern fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo);
700 extern MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo);
701 extern bool AggStateIsShared(FunctionCallInfo fcinfo);
702 extern void AggRegisterCallback(FunctionCallInfo fcinfo,
704  Datum arg);
705 
706 /*
707  * We allow plugin modules to hook function entry/exit. This is intended
708  * as support for loadable security policy modules, which may want to
709  * perform additional privilege checks on function entry or exit, or to do
710  * other internal bookkeeping. To make this possible, such modules must be
711  * able not only to support normal function entry and exit, but also to trap
712  * the case where we bail out due to an error; and they must also be able to
713  * prevent inlining.
714  */
715 typedef enum FmgrHookEventType
716 {
721 
723 
724 typedef void (*fmgr_hook_type) (FmgrHookEventType event,
725  FmgrInfo *flinfo, Datum *arg);
726 
729 
730 #define FmgrHookIsNeeded(fn_oid) \
731  (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
732 
733 /*
734  * !!! OLD INTERFACE !!!
735  *
736  * fmgr() is the only remaining vestige of the old-style caller support
737  * functions. It's no longer used anywhere in the Postgres distribution,
738  * but we should leave it around for a release or two to ease the transition
739  * for user-supplied C functions. OidFunctionCallN() replaces it for new
740  * code.
741  */
742 
743 /*
744  * DEPRECATED, DO NOT USE IN NEW CODE
745  */
746 extern char *fmgr(Oid procedureId,...);
747 
748 #endif /* FMGR_H */
Datum CallerFInfoFunctionCall2(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:995
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
Definition: nodeAgg.c:4127
fmAggrefPtr AggGetAggref(FunctionCallInfo fcinfo)
Definition: nodeAgg.c:4171
void(* fmExprContextCallbackFunction)(Datum arg)
Definition: fmgr.h:26
Datum(* PGFunction)(FunctionCallInfo fcinfo)
Definition: fmgr.h:40
Definition: fmgr.h:56
Oid get_fn_expr_rettype(FmgrInfo *flinfo)
Definition: fmgr.c:1882
PGDLLIMPORT fmgr_hook_type fmgr_hook
Definition: fmgr.c:37
Datum OidFunctionCall9Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
Definition: fmgr.c:1563
short fn_nargs
Definition: fmgr.h:60
struct StringInfoData * fmStringInfo
Definition: fmgr.h:29
bool get_call_expr_arg_stable(fmNodePtr expr, int argnum)
MemoryContext fn_mcxt
Definition: fmgr.h:65
int indexmaxkeys
Definition: fmgr.h:417
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
Definition: fmgr.c:1662
Oid get_call_expr_argtype(fmNodePtr expr, int argnum)
PGFunction fn_addr
Definition: fmgr.h:58
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:1042
void(* fmgr_hook_type)(FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg)
Definition: fmgr.h:724
fmNodePtr context
Definition: fmgr.h:80
struct FunctionCallInfoData FunctionCallInfoData
Datum DirectFunctionCall8Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
Definition: fmgr.c:891
Datum CallerFInfoFunctionCall1(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1)
Definition: fmgr.c:975
Datum ReceiveFunctionCall(FmgrInfo *flinfo, fmStringInfo buf, Oid typioparam, int32 typmod)
Definition: fmgr.c:1676
int namedatalen
Definition: fmgr.h:418
Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
Definition: fmgr.c:1089
Datum DirectFunctionCall4Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
Definition: fmgr.c:769
Definition: nodes.h:512
char * OidOutputFunctionCall(Oid functionId, Datum val)
Definition: fmgr.c:1742
char * fmgr(Oid procedureId,...)
Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
Definition: fmgr.c:1145
unsigned int Oid
Definition: postgres_ext.h:31
Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
Definition: fmgr.c:1177
Datum OidFunctionCall3Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Definition: fmgr.c:1362
Datum DirectFunctionCall7Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
Definition: fmgr.c:857
struct varlena * pg_detoast_datum_packed(struct varlena *datum)
Definition: fmgr.c:1858
#define PGDLLIMPORT
Definition: c.h:1050
char bool
Definition: c.h:247
signed int int32
Definition: c.h:284
#define FUNC_MAX_ARGS
Size EstimateLibraryStateSpace(void)
Definition: dfmgr.c:711
PGFunction lookup_external_function(void *filehandle, const char *funcname)
Definition: dfmgr.c:162
bool get_fn_expr_variadic(FmgrInfo *flinfo)
Definition: fmgr.c:2038
bool AggStateIsShared(FunctionCallInfo fcinfo)
Definition: nodeAgg.c:4231
FmgrInfo * flinfo
Definition: fmgr.h:79
struct Aggref * fmAggrefPtr
Definition: fmgr.h:23
Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum)
Definition: fmgr.c:1904
Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
Definition: fmgr.c:1116
bytea * SendFunctionCall(FmgrInfo *flinfo, Datum val)
Definition: fmgr.c:1723
bool fn_retset
Definition: fmgr.h:62
const Pg_finfo_record * fetch_finfo_record(void *filehandle, const char *funcname)
Definition: fmgr.c:379
void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt)
Definition: fmgr.c:519
bool fn_strict
Definition: fmgr.h:61
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
Definition: fmgr.c:132
MemoryContext AggGetTempMemoryContext(FunctionCallInfo fcinfo)
Definition: nodeAgg.c:4205
bool(* needs_fmgr_hook_type)(Oid fn_oid)
Definition: fmgr.h:722
struct FunctionCallInfoData * FunctionCallInfo
Definition: fmgr.h:38
Datum DirectFunctionCall2Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:722
Datum OidFunctionCall1Coll(Oid functionId, Oid collation, Datum arg1)
Definition: fmgr.c:1314
bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid)
Definition: fmgr.c:2088
static char * buf
Definition: pg_test_fsync.c:67
FmgrHookEventType
Definition: fmgr.h:715
Datum OidFunctionCall6Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
Definition: fmgr.c:1452
int funcmaxargs
Definition: fmgr.h:416
fmNodePtr resultinfo
Definition: fmgr.h:81
Definition: fmgr.h:718
PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook
Definition: fmgr.c:36
Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Definition: fmgr.c:1064
Datum DirectFunctionCall5Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
Definition: fmgr.c:796
Datum OidFunctionCall2Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:1337
int float8byval
Definition: fmgr.h:420
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
Definition: fmgr.c:1618
uintptr_t Datum
Definition: postgres.h:372
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition: fmgr.c:122
Datum OidReceiveFunctionCall(Oid functionId, fmStringInfo buf, Oid typioparam, int32 typmod)
Definition: fmgr.c:1751
Oid fn_oid
Definition: fmgr.h:59
void clear_external_function_hash(void *filehandle)
Definition: fmgr.c:503
void load_file(const char *filename, bool restricted)
Definition: dfmgr.c:137
void AggRegisterCallback(FunctionCallInfo fcinfo, fmExprContextCallbackFunction func, Datum arg)
Definition: nodeAgg.c:4270
void ** find_rendezvous_variable(const char *varName)
Definition: dfmgr.c:672
Datum DirectFunctionCall6Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
Definition: fmgr.c:825
struct varlena * pg_detoast_datum_copy(struct varlena *datum)
Definition: fmgr.c:1835
fmNodePtr fn_expr
Definition: fmgr.h:66
Datum DirectFunctionCall9Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
Definition: fmgr.c:927
Datum OidFunctionCall4Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
Definition: fmgr.c:1390
Datum FunctionCall8Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
Definition: fmgr.c:1211
size_t Size
Definition: c.h:404
struct FmgrInfo FmgrInfo
struct Node * fmNodePtr
Definition: fmgr.h:22
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
Definition: fmgr.c:1022
void * fn_extra
Definition: fmgr.h:64
int float4byval
Definition: fmgr.h:419
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
Definition: fmgr.c:1733
static char * filename
Definition: pg_dumpall.c:90
void RestoreLibraryState(char *start_address)
Definition: dfmgr.c:750
void SerializeLibraryState(Size maxsize, char *start_address)
Definition: dfmgr.c:728
PGFunction load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
Definition: dfmgr.c:94
unsigned char fn_stats
Definition: fmgr.h:63
bytea * OidSendFunctionCall(Oid functionId, Datum val)
Definition: fmgr.c:1761
bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum)
Definition: fmgr.c:1969
void * arg
Definition: c.h:487
Datum OidFunctionCall0Coll(Oid functionId, Oid collation)
Definition: fmgr.c:1294
Datum OidFunctionCall5Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
Definition: fmgr.c:1420
Datum DirectFunctionCall3Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Definition: fmgr.c:744
Datum DirectFunctionCall1Coll(PGFunction func, Oid collation, Datum arg1)
Definition: fmgr.c:702
Oid fmgr_internal_function(const char *proname)
Definition: fmgr.c:534
struct varlena * pg_detoast_datum(struct varlena *datum)
Definition: fmgr.c:1826
struct varlena * pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count)
Definition: fmgr.c:1851
Datum OidFunctionCall7Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
Definition: fmgr.c:1487
int api_version
Definition: fmgr.h:355
long val
Definition: informix.c:689
char * Dynamic_library_path
Definition: dfmgr.c:64
Datum OidFunctionCall8Coll(Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
Definition: fmgr.c:1524
int version
Definition: fmgr.h:415
Datum FunctionCall9Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
Definition: fmgr.c:1247