PostgreSQL Source Code  git master
fmgr.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FmgrInfo
 
struct  FunctionCallInfoBaseData
 
struct  Pg_finfo_record
 
struct  Pg_magic_struct
 

Macros

#define FIELDNO_FUNCTIONCALLINFODATA_ISNULL   4
 
#define FIELDNO_FUNCTIONCALLINFODATA_ARGS   6
 
#define SizeForFunctionCallInfo(nargs)
 
#define LOCAL_FCINFO(name, nargs)
 
#define fmgr_info_set_expr(expr, finfo)    ((finfo)->fn_expr = (expr))
 
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
 
#define FunctionCallInvoke(fcinfo)   ((* (fcinfo)->flinfo->fn_addr) (fcinfo))
 
#define PG_FUNCTION_ARGS   FunctionCallInfo fcinfo
 
#define PG_GET_COLLATION()   (fcinfo->fncollation)
 
#define PG_NARGS()   (fcinfo->nargs)
 
#define PG_ARGISNULL(n)   (fcinfo->args[n].isnull)
 
#define PG_DETOAST_DATUM(datum)    pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_COPY(datum)    pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_SLICE(datum, f, c)
 
#define PG_DETOAST_DATUM_PACKED(datum)    pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
 
#define PG_FREE_IF_COPY(ptr, n)
 
#define PG_GETARG_DATUM(n)   (fcinfo->args[n].value)
 
#define PG_GETARG_INT32(n)   DatumGetInt32(PG_GETARG_DATUM(n))
 
#define PG_GETARG_UINT32(n)   DatumGetUInt32(PG_GETARG_DATUM(n))
 
#define PG_GETARG_INT16(n)   DatumGetInt16(PG_GETARG_DATUM(n))
 
#define PG_GETARG_UINT16(n)   DatumGetUInt16(PG_GETARG_DATUM(n))
 
#define PG_GETARG_CHAR(n)   DatumGetChar(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BOOL(n)   DatumGetBool(PG_GETARG_DATUM(n))
 
#define PG_GETARG_OID(n)   DatumGetObjectId(PG_GETARG_DATUM(n))
 
#define PG_GETARG_POINTER(n)   DatumGetPointer(PG_GETARG_DATUM(n))
 
#define PG_GETARG_CSTRING(n)   DatumGetCString(PG_GETARG_DATUM(n))
 
#define PG_GETARG_NAME(n)   DatumGetName(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TRANSACTIONID(n)   DatumGetTransactionId(PG_GETARG_DATUM(n))
 
#define PG_GETARG_FLOAT4(n)   DatumGetFloat4(PG_GETARG_DATUM(n))
 
#define PG_GETARG_FLOAT8(n)   DatumGetFloat8(PG_GETARG_DATUM(n))
 
#define PG_GETARG_INT64(n)   DatumGetInt64(PG_GETARG_DATUM(n))
 
#define PG_GETARG_RAW_VARLENA_P(n)   ((struct varlena *) PG_GETARG_POINTER(n))
 
#define PG_GETARG_VARLENA_P(n)   PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARLENA_PP(n)   PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
 
#define DatumGetByteaPP(X)   ((bytea *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetTextPP(X)   ((text *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetBpCharPP(X)   ((BpChar *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetVarCharPP(X)   ((VarChar *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetHeapTupleHeader(X)   ((HeapTupleHeader) PG_DETOAST_DATUM(X))
 
#define DatumGetByteaPCopy(X)   ((bytea *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetTextPCopy(X)   ((text *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetBpCharPCopy(X)   ((BpChar *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetVarCharPCopy(X)   ((VarChar *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetHeapTupleHeaderCopy(X)   ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetByteaPSlice(X, m, n)   ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetTextPSlice(X, m, n)   ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetBpCharPSlice(X, m, n)   ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetVarCharPSlice(X, m, n)   ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define PG_GETARG_BYTEA_PP(n)   DatumGetByteaPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_PP(n)   DatumGetTextPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_PP(n)   DatumGetBpCharPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_PP(n)   DatumGetVarCharPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_HEAPTUPLEHEADER(n)   DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BYTEA_P_COPY(n)   DatumGetByteaPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_P_COPY(n)   DatumGetTextPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_P_COPY(n)   DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_P_COPY(n)   DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_HEAPTUPLEHEADER_COPY(n)   DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BYTEA_P_SLICE(n, a, b)   DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_TEXT_P_SLICE(n, a, b)   DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_BPCHAR_P_SLICE(n, a, b)   DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_VARCHAR_P_SLICE(n, a, b)   DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
 
#define DatumGetByteaP(X)   ((bytea *) PG_DETOAST_DATUM(X))
 
#define DatumGetTextP(X)   ((text *) PG_DETOAST_DATUM(X))
 
#define DatumGetBpCharP(X)   ((BpChar *) PG_DETOAST_DATUM(X))
 
#define DatumGetVarCharP(X)   ((VarChar *) PG_DETOAST_DATUM(X))
 
#define PG_GETARG_BYTEA_P(n)   DatumGetByteaP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_P(n)   DatumGetTextP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_P(n)   DatumGetBpCharP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_P(n)   DatumGetVarCharP(PG_GETARG_DATUM(n))
 
#define PG_HAS_OPCLASS_OPTIONS()   has_fn_opclass_options(fcinfo->flinfo)
 
#define PG_GET_OPCLASS_OPTIONS()   get_fn_opclass_options(fcinfo->flinfo)
 
#define PG_RETURN_NULL()    do { fcinfo->isnull = true; return (Datum) 0; } while (0)
 
#define PG_RETURN_VOID()   return (Datum) 0
 
#define PG_RETURN_DATUM(x)   return (x)
 
#define PG_RETURN_INT32(x)   return Int32GetDatum(x)
 
#define PG_RETURN_UINT32(x)   return UInt32GetDatum(x)
 
#define PG_RETURN_INT16(x)   return Int16GetDatum(x)
 
#define PG_RETURN_UINT16(x)   return UInt16GetDatum(x)
 
#define PG_RETURN_CHAR(x)   return CharGetDatum(x)
 
#define PG_RETURN_BOOL(x)   return BoolGetDatum(x)
 
#define PG_RETURN_OID(x)   return ObjectIdGetDatum(x)
 
#define PG_RETURN_POINTER(x)   return PointerGetDatum(x)
 
#define PG_RETURN_CSTRING(x)   return CStringGetDatum(x)
 
#define PG_RETURN_NAME(x)   return NameGetDatum(x)
 
#define PG_RETURN_TRANSACTIONID(x)   return TransactionIdGetDatum(x)
 
#define PG_RETURN_FLOAT4(x)   return Float4GetDatum(x)
 
#define PG_RETURN_FLOAT8(x)   return Float8GetDatum(x)
 
#define PG_RETURN_INT64(x)   return Int64GetDatum(x)
 
#define PG_RETURN_UINT64(x)   return UInt64GetDatum(x)
 
#define PG_RETURN_BYTEA_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_TEXT_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_BPCHAR_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_VARCHAR_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_HEAPTUPLEHEADER(x)   return HeapTupleHeaderGetDatum(x)
 
#define PG_FUNCTION_INFO_V1(funcname)
 
#define PG_MODULE_MAGIC_DATA
 
#define PG_MAGIC_FUNCTION_NAME   Pg_magic_func
 
#define PG_MAGIC_FUNCTION_NAME_STRING   "Pg_magic_func"
 
#define PG_MODULE_MAGIC
 
#define DirectFunctionCall1(func, arg1)    DirectFunctionCall1Coll(func, InvalidOid, arg1)
 
#define DirectFunctionCall2(func, arg1, arg2)    DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)
 
#define DirectFunctionCall3(func, arg1, arg2, arg3)    DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)
 
#define DirectFunctionCall4(func, arg1, arg2, arg3, arg4)    DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)
 
#define DirectFunctionCall5(func, arg1, arg2, arg3, arg4, arg5)    DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)
 
#define DirectFunctionCall6(func, arg1, arg2, arg3, arg4, arg5, arg6)    DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
 
#define DirectFunctionCall7(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)    DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
 
#define DirectFunctionCall8(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)    DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
 
#define DirectFunctionCall9(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)    DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
 
#define FunctionCall1(flinfo, arg1)    FunctionCall1Coll(flinfo, InvalidOid, arg1)
 
#define FunctionCall2(flinfo, arg1, arg2)    FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)
 
#define FunctionCall3(flinfo, arg1, arg2, arg3)    FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)
 
#define FunctionCall4(flinfo, arg1, arg2, arg3, arg4)    FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)
 
#define FunctionCall5(flinfo, arg1, arg2, arg3, arg4, arg5)    FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)
 
#define FunctionCall6(flinfo, arg1, arg2, arg3, arg4, arg5, arg6)    FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
 
#define FunctionCall7(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7)    FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
 
#define FunctionCall8(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)    FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
 
#define FunctionCall9(flinfo, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)    FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
 
#define OidFunctionCall0(functionId)    OidFunctionCall0Coll(functionId, InvalidOid)
 
#define OidFunctionCall1(functionId, arg1)    OidFunctionCall1Coll(functionId, InvalidOid, arg1)
 
#define OidFunctionCall2(functionId, arg1, arg2)    OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)
 
#define OidFunctionCall3(functionId, arg1, arg2, arg3)    OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)
 
#define OidFunctionCall4(functionId, arg1, arg2, arg3, arg4)    OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)
 
#define OidFunctionCall5(functionId, arg1, arg2, arg3, arg4, arg5)    OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)
 
#define OidFunctionCall6(functionId, arg1, arg2, arg3, arg4, arg5, arg6)    OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)
 
#define OidFunctionCall7(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7)    OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
 
#define OidFunctionCall8(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)    OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
 
#define OidFunctionCall9(functionId, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)    OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
 
#define AGG_CONTEXT_AGGREGATE   1 /* regular aggregate */
 
#define AGG_CONTEXT_WINDOW   2 /* window function */
 
#define FmgrHookIsNeeded(fn_oid)    (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
 

Typedefs

typedef struct NodefmNodePtr
 
typedef struct AggreffmAggrefPtr
 
typedef void(* fmExprContextCallbackFunction) (Datum arg)
 
typedef struct StringInfoDatafmStringInfo
 
typedef struct FunctionCallInfoBaseDataFunctionCallInfo
 
typedef Datum(* PGFunction) (FunctionCallInfo fcinfo)
 
typedef struct FmgrInfo FmgrInfo
 
typedef struct FunctionCallInfoBaseData FunctionCallInfoBaseData
 
typedef const Pg_finfo_record *(* PGFInfoFunction) (void)
 
typedef const Pg_magic_struct *(* PGModuleMagicFunction) (void)
 
typedef enum FmgrHookEventType FmgrHookEventType
 
typedef bool(* needs_fmgr_hook_type) (Oid fn_oid)
 
typedef void(* fmgr_hook_type) (FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg)
 

Enumerations

enum  FmgrHookEventType { FHET_START , FHET_END , FHET_ABORT }
 

Functions

void fmgr_info (Oid functionId, FmgrInfo *finfo)
 
void fmgr_info_cxt (Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
 
void fmgr_info_copy (FmgrInfo *dstinfo, FmgrInfo *srcinfo, MemoryContext destcxt)
 
void fmgr_symbol (Oid functionId, char **mod, char **fn)
 
struct varlenapg_detoast_datum (struct varlena *datum)
 
struct varlenapg_detoast_datum_copy (struct varlena *datum)
 
struct varlenapg_detoast_datum_slice (struct varlena *datum, int32 first, int32 count)
 
struct varlenapg_detoast_datum_packed (struct varlena *datum)
 
PGDLLEXPORT void _PG_init (void)
 
PGDLLEXPORT void _PG_fini (void)
 
 StaticAssertDecl (sizeof(FMGR_ABI_EXTRA)<=sizeof(((Pg_magic_struct *) 0) ->abi_extra), "FMGR_ABI_EXTRA too long")
 
Datum DirectFunctionCall1Coll (PGFunction func, Oid collation, Datum arg1)
 
Datum DirectFunctionCall2Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2)
 
Datum DirectFunctionCall3Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3)
 
Datum DirectFunctionCall4Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
 
Datum DirectFunctionCall5Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
 
Datum DirectFunctionCall6Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
 
Datum DirectFunctionCall7Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
 
Datum DirectFunctionCall8Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
 
Datum DirectFunctionCall9Coll (PGFunction func, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
 
Datum CallerFInfoFunctionCall1 (PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1)
 
Datum CallerFInfoFunctionCall2 (PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
 
Datum FunctionCall0Coll (FmgrInfo *flinfo, Oid collation)
 
Datum FunctionCall1Coll (FmgrInfo *flinfo, Oid collation, Datum arg1)
 
Datum FunctionCall2Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
 
Datum FunctionCall3Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
 
Datum FunctionCall4Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
 
Datum FunctionCall5Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
 
Datum FunctionCall6Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
 
Datum FunctionCall7Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
 
Datum FunctionCall8Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
 
Datum FunctionCall9Coll (FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
 
Datum OidFunctionCall0Coll (Oid functionId, Oid collation)
 
Datum OidFunctionCall1Coll (Oid functionId, Oid collation, Datum arg1)
 
Datum OidFunctionCall2Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2)
 
Datum OidFunctionCall3Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3)
 
Datum OidFunctionCall4Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
 
Datum OidFunctionCall5Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
 
Datum OidFunctionCall6Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
 
Datum OidFunctionCall7Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
 
Datum OidFunctionCall8Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8)
 
Datum OidFunctionCall9Coll (Oid functionId, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7, Datum arg8, Datum arg9)
 
Datum InputFunctionCall (FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
 
bool InputFunctionCallSafe (FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod, fmNodePtr escontext, Datum *result)
 
bool DirectInputFunctionCallSafe (PGFunction func, char *str, Oid typioparam, int32 typmod, fmNodePtr escontext, Datum *result)
 
Datum OidInputFunctionCall (Oid functionId, char *str, Oid typioparam, int32 typmod)
 
char * OutputFunctionCall (FmgrInfo *flinfo, Datum val)
 
char * OidOutputFunctionCall (Oid functionId, Datum val)
 
Datum ReceiveFunctionCall (FmgrInfo *flinfo, fmStringInfo buf, Oid typioparam, int32 typmod)
 
Datum OidReceiveFunctionCall (Oid functionId, fmStringInfo buf, Oid typioparam, int32 typmod)
 
byteaSendFunctionCall (FmgrInfo *flinfo, Datum val)
 
byteaOidSendFunctionCall (Oid functionId, Datum val)
 
const Pg_finfo_recordfetch_finfo_record (void *filehandle, const char *funcname)
 
Oid fmgr_internal_function (const char *proname)
 
Oid get_fn_expr_rettype (FmgrInfo *flinfo)
 
Oid get_fn_expr_argtype (FmgrInfo *flinfo, int argnum)
 
Oid get_call_expr_argtype (fmNodePtr expr, int argnum)
 
bool get_fn_expr_arg_stable (FmgrInfo *flinfo, int argnum)
 
bool get_call_expr_arg_stable (fmNodePtr expr, int argnum)
 
bool get_fn_expr_variadic (FmgrInfo *flinfo)
 
byteaget_fn_opclass_options (FmgrInfo *flinfo)
 
bool has_fn_opclass_options (FmgrInfo *flinfo)
 
void set_fn_opclass_options (FmgrInfo *flinfo, bytea *options)
 
bool CheckFunctionValidatorAccess (Oid validatorOid, Oid functionOid)
 
void * load_external_function (const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
 
void * lookup_external_function (void *filehandle, const char *funcname)
 
void load_file (const char *filename, bool restricted)
 
void ** find_rendezvous_variable (const char *varName)
 
Size EstimateLibraryStateSpace (void)
 
void SerializeLibraryState (Size maxsize, char *start_address)
 
void RestoreLibraryState (char *start_address)
 
int AggCheckCallContext (FunctionCallInfo fcinfo, MemoryContext *aggcontext)
 
fmAggrefPtr AggGetAggref (FunctionCallInfo fcinfo)
 
MemoryContext AggGetTempMemoryContext (FunctionCallInfo fcinfo)
 
bool AggStateIsShared (FunctionCallInfo fcinfo)
 
void AggRegisterCallback (FunctionCallInfo fcinfo, fmExprContextCallbackFunction func, Datum arg)
 

Variables

PGDLLIMPORT char * Dynamic_library_path
 
PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook
 
PGDLLIMPORT fmgr_hook_type fmgr_hook
 

Macro Definition Documentation

◆ AGG_CONTEXT_AGGREGATE

#define AGG_CONTEXT_AGGREGATE   1 /* regular aggregate */

Definition at line 761 of file fmgr.h.

◆ AGG_CONTEXT_WINDOW

#define AGG_CONTEXT_WINDOW   2 /* window function */

Definition at line 762 of file fmgr.h.

◆ DatumGetBpCharP

#define DatumGetBpCharP (   X)    ((BpChar *) PG_DETOAST_DATUM(X))

Definition at line 333 of file fmgr.h.

◆ DatumGetBpCharPCopy

#define DatumGetBpCharPCopy (   X)    ((BpChar *) PG_DETOAST_DATUM_COPY(X))

Definition at line 299 of file fmgr.h.

◆ DatumGetBpCharPP

#define DatumGetBpCharPP (   X)    ((BpChar *) PG_DETOAST_DATUM_PACKED(X))

Definition at line 293 of file fmgr.h.

◆ DatumGetBpCharPSlice

#define DatumGetBpCharPSlice (   X,
  m,
 
)    ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))

Definition at line 305 of file fmgr.h.

◆ DatumGetByteaP

#define DatumGetByteaP (   X)    ((bytea *) PG_DETOAST_DATUM(X))

Definition at line 331 of file fmgr.h.

◆ DatumGetByteaPCopy

#define DatumGetByteaPCopy (   X)    ((bytea *) PG_DETOAST_DATUM_COPY(X))

Definition at line 297 of file fmgr.h.

◆ DatumGetByteaPP

#define DatumGetByteaPP (   X)    ((bytea *) PG_DETOAST_DATUM_PACKED(X))

Definition at line 291 of file fmgr.h.

◆ DatumGetByteaPSlice

#define DatumGetByteaPSlice (   X,
  m,
 
)    ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))

Definition at line 303 of file fmgr.h.

◆ DatumGetHeapTupleHeader

#define DatumGetHeapTupleHeader (   X)    ((HeapTupleHeader) PG_DETOAST_DATUM(X))

Definition at line 295 of file fmgr.h.

◆ DatumGetHeapTupleHeaderCopy

#define DatumGetHeapTupleHeaderCopy (   X)    ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))

Definition at line 301 of file fmgr.h.

◆ DatumGetTextP

#define DatumGetTextP (   X)    ((text *) PG_DETOAST_DATUM(X))

Definition at line 332 of file fmgr.h.

◆ DatumGetTextPCopy

#define DatumGetTextPCopy (   X)    ((text *) PG_DETOAST_DATUM_COPY(X))

Definition at line 298 of file fmgr.h.

◆ DatumGetTextPP

#define DatumGetTextPP (   X)    ((text *) PG_DETOAST_DATUM_PACKED(X))

Definition at line 292 of file fmgr.h.

◆ DatumGetTextPSlice

#define DatumGetTextPSlice (   X,
  m,
 
)    ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))

Definition at line 304 of file fmgr.h.

◆ DatumGetVarCharP

#define DatumGetVarCharP (   X)    ((VarChar *) PG_DETOAST_DATUM(X))

Definition at line 334 of file fmgr.h.

◆ DatumGetVarCharPCopy

#define DatumGetVarCharPCopy (   X)    ((VarChar *) PG_DETOAST_DATUM_COPY(X))

Definition at line 300 of file fmgr.h.

◆ DatumGetVarCharPP

#define DatumGetVarCharPP (   X)    ((VarChar *) PG_DETOAST_DATUM_PACKED(X))

Definition at line 294 of file fmgr.h.

◆ DatumGetVarCharPSlice

#define DatumGetVarCharPSlice (   X,
  m,
 
)    ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))

Definition at line 306 of file fmgr.h.

◆ DirectFunctionCall1

#define DirectFunctionCall1 (   func,
  arg1 
)     DirectFunctionCall1Coll(func, InvalidOid, arg1)

Definition at line 642 of file fmgr.h.

◆ DirectFunctionCall2

#define DirectFunctionCall2 (   func,
  arg1,
  arg2 
)     DirectFunctionCall2Coll(func, InvalidOid, arg1, arg2)

Definition at line 644 of file fmgr.h.

◆ DirectFunctionCall3

#define DirectFunctionCall3 (   func,
  arg1,
  arg2,
  arg3 
)     DirectFunctionCall3Coll(func, InvalidOid, arg1, arg2, arg3)

Definition at line 646 of file fmgr.h.

◆ DirectFunctionCall4

#define DirectFunctionCall4 (   func,
  arg1,
  arg2,
  arg3,
  arg4 
)     DirectFunctionCall4Coll(func, InvalidOid, arg1, arg2, arg3, arg4)

Definition at line 648 of file fmgr.h.

◆ DirectFunctionCall5

#define DirectFunctionCall5 (   func,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5 
)     DirectFunctionCall5Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5)

Definition at line 650 of file fmgr.h.

◆ DirectFunctionCall6

#define DirectFunctionCall6 (   func,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6 
)     DirectFunctionCall6Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)

Definition at line 652 of file fmgr.h.

◆ DirectFunctionCall7

#define DirectFunctionCall7 (   func,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7 
)     DirectFunctionCall7Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)

Definition at line 654 of file fmgr.h.

◆ DirectFunctionCall8

#define DirectFunctionCall8 (   func,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8 
)     DirectFunctionCall8Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

Definition at line 656 of file fmgr.h.

◆ DirectFunctionCall9

#define DirectFunctionCall9 (   func,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8,
  arg9 
)     DirectFunctionCall9Coll(func, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)

Definition at line 658 of file fmgr.h.

◆ FIELDNO_FUNCTIONCALLINFODATA_ARGS

#define FIELDNO_FUNCTIONCALLINFODATA_ARGS   6

Definition at line 94 of file fmgr.h.

◆ FIELDNO_FUNCTIONCALLINFODATA_ISNULL

#define FIELDNO_FUNCTIONCALLINFODATA_ISNULL   4

Definition at line 91 of file fmgr.h.

◆ fmgr_info_set_expr

#define fmgr_info_set_expr (   expr,
  finfo 
)     ((finfo)->fn_expr = (expr))

Definition at line 135 of file fmgr.h.

◆ FmgrHookIsNeeded

#define FmgrHookIsNeeded (   fn_oid)     (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))

Definition at line 797 of file fmgr.h.

◆ FunctionCall1

#define FunctionCall1 (   flinfo,
  arg1 
)     FunctionCall1Coll(flinfo, InvalidOid, arg1)

Definition at line 660 of file fmgr.h.

◆ FunctionCall2

#define FunctionCall2 (   flinfo,
  arg1,
  arg2 
)     FunctionCall2Coll(flinfo, InvalidOid, arg1, arg2)

Definition at line 662 of file fmgr.h.

◆ FunctionCall3

#define FunctionCall3 (   flinfo,
  arg1,
  arg2,
  arg3 
)     FunctionCall3Coll(flinfo, InvalidOid, arg1, arg2, arg3)

Definition at line 664 of file fmgr.h.

◆ FunctionCall4

#define FunctionCall4 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4 
)     FunctionCall4Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4)

Definition at line 666 of file fmgr.h.

◆ FunctionCall5

#define FunctionCall5 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5 
)     FunctionCall5Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5)

Definition at line 668 of file fmgr.h.

◆ FunctionCall6

#define FunctionCall6 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6 
)     FunctionCall6Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)

Definition at line 670 of file fmgr.h.

◆ FunctionCall7

#define FunctionCall7 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7 
)     FunctionCall7Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)

Definition at line 672 of file fmgr.h.

◆ FunctionCall8

#define FunctionCall8 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8 
)     FunctionCall8Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

Definition at line 674 of file fmgr.h.

◆ FunctionCall9

#define FunctionCall9 (   flinfo,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8,
  arg9 
)     FunctionCall9Coll(flinfo, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)

Definition at line 676 of file fmgr.h.

◆ FunctionCallInvoke

#define FunctionCallInvoke (   fcinfo)    ((* (fcinfo)->flinfo->fn_addr) (fcinfo))

Definition at line 172 of file fmgr.h.

◆ InitFunctionCallInfoData

#define InitFunctionCallInfoData (   Fcinfo,
  Flinfo,
  Nargs,
  Collation,
  Context,
  Resultinfo 
)
Value:
do { \
(Fcinfo).flinfo = (Flinfo); \
(Fcinfo).context = (Context); \
(Fcinfo).resultinfo = (Resultinfo); \
(Fcinfo).fncollation = (Collation); \
(Fcinfo).isnull = false; \
(Fcinfo).nargs = (Nargs); \
} while (0)

Definition at line 150 of file fmgr.h.

◆ LOCAL_FCINFO

#define LOCAL_FCINFO (   name,
  nargs 
)
Value:
/* use union with FunctionCallInfoBaseData to guarantee alignment */ \
union \
{ \
FunctionCallInfoBaseData fcinfo; \
/* ensure enough space for nargs args is available */ \
char fcinfo_data[SizeForFunctionCallInfo(nargs)]; \
} name##data; \
FunctionCallInfo name = &name##data.fcinfo
const char * name
Definition: encode.c:571
#define SizeForFunctionCallInfo(nargs)
Definition: fmgr.h:102
const void * data

Definition at line 110 of file fmgr.h.

◆ OidFunctionCall0

#define OidFunctionCall0 (   functionId)     OidFunctionCall0Coll(functionId, InvalidOid)

Definition at line 678 of file fmgr.h.

◆ OidFunctionCall1

#define OidFunctionCall1 (   functionId,
  arg1 
)     OidFunctionCall1Coll(functionId, InvalidOid, arg1)

Definition at line 680 of file fmgr.h.

◆ OidFunctionCall2

#define OidFunctionCall2 (   functionId,
  arg1,
  arg2 
)     OidFunctionCall2Coll(functionId, InvalidOid, arg1, arg2)

Definition at line 682 of file fmgr.h.

◆ OidFunctionCall3

#define OidFunctionCall3 (   functionId,
  arg1,
  arg2,
  arg3 
)     OidFunctionCall3Coll(functionId, InvalidOid, arg1, arg2, arg3)

Definition at line 684 of file fmgr.h.

◆ OidFunctionCall4

#define OidFunctionCall4 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4 
)     OidFunctionCall4Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4)

Definition at line 686 of file fmgr.h.

◆ OidFunctionCall5

#define OidFunctionCall5 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5 
)     OidFunctionCall5Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5)

Definition at line 688 of file fmgr.h.

◆ OidFunctionCall6

#define OidFunctionCall6 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6 
)     OidFunctionCall6Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6)

Definition at line 690 of file fmgr.h.

◆ OidFunctionCall7

#define OidFunctionCall7 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7 
)     OidFunctionCall7Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7)

Definition at line 692 of file fmgr.h.

◆ OidFunctionCall8

#define OidFunctionCall8 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8 
)     OidFunctionCall8Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

Definition at line 694 of file fmgr.h.

◆ OidFunctionCall9

#define OidFunctionCall9 (   functionId,
  arg1,
  arg2,
  arg3,
  arg4,
  arg5,
  arg6,
  arg7,
  arg8,
  arg9 
)     OidFunctionCall9Coll(functionId, InvalidOid, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)

Definition at line 696 of file fmgr.h.

◆ PG_ARGISNULL

#define PG_ARGISNULL (   n)    (fcinfo->args[n].isnull)

Definition at line 209 of file fmgr.h.

◆ PG_DETOAST_DATUM

#define PG_DETOAST_DATUM (   datum)     pg_detoast_datum((struct varlena *) DatumGetPointer(datum))

Definition at line 240 of file fmgr.h.

◆ PG_DETOAST_DATUM_COPY

#define PG_DETOAST_DATUM_COPY (   datum)     pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))

Definition at line 242 of file fmgr.h.

◆ PG_DETOAST_DATUM_PACKED

#define PG_DETOAST_DATUM_PACKED (   datum)     pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))

Definition at line 248 of file fmgr.h.

◆ PG_DETOAST_DATUM_SLICE

#define PG_DETOAST_DATUM_SLICE (   datum,
  f,
  c 
)
Value:
(int32) (f), (int32) (c))
signed int int32
Definition: c.h:478
struct varlena * pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count)
Definition: fmgr.c:1844
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312
char * c
Definition: c.h:671

Definition at line 244 of file fmgr.h.

◆ PG_FREE_IF_COPY

#define PG_FREE_IF_COPY (   ptr,
 
)
Value:
do { \
if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
pfree(ptr); \
} while (0)
char * Pointer
Definition: c.h:467
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276

Definition at line 260 of file fmgr.h.

◆ PG_FUNCTION_ARGS

#define PG_FUNCTION_ARGS   FunctionCallInfo fcinfo

Definition at line 193 of file fmgr.h.

◆ PG_FUNCTION_INFO_V1

#define PG_FUNCTION_INFO_V1 (   funcname)
Value:
extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
const Pg_finfo_record * \
CppConcat(pg_finfo_,funcname) (void) \
{ \
static const Pg_finfo_record my_finfo = { 1 }; \
return &my_finfo; \
} \
extern int no_such_variable
#define CppConcat(x, y)
Definition: c.h:312
#define PGDLLEXPORT
Definition: c.h:1318
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193
#define funcname
Definition: indent_codes.h:69
uintptr_t Datum
Definition: postgres.h:64

Definition at line 415 of file fmgr.h.

◆ PG_GET_COLLATION

#define PG_GET_COLLATION ( )    (fcinfo->fncollation)

Definition at line 198 of file fmgr.h.

◆ PG_GET_OPCLASS_OPTIONS

#define PG_GET_OPCLASS_OPTIONS ( )    get_fn_opclass_options(fcinfo->flinfo)

Definition at line 342 of file fmgr.h.

◆ PG_GETARG_BOOL

#define PG_GETARG_BOOL (   n)    DatumGetBool(PG_GETARG_DATUM(n))

Definition at line 274 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P

#define PG_GETARG_BPCHAR_P (   n)    DatumGetBpCharP(PG_GETARG_DATUM(n))

Definition at line 337 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P_COPY

#define PG_GETARG_BPCHAR_P_COPY (   n)    DatumGetBpCharPCopy(PG_GETARG_DATUM(n))

Definition at line 316 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P_SLICE

#define PG_GETARG_BPCHAR_P_SLICE (   n,
  a,
  b 
)    DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)

Definition at line 322 of file fmgr.h.

◆ PG_GETARG_BPCHAR_PP

#define PG_GETARG_BPCHAR_PP (   n)    DatumGetBpCharPP(PG_GETARG_DATUM(n))

Definition at line 310 of file fmgr.h.

◆ PG_GETARG_BYTEA_P

#define PG_GETARG_BYTEA_P (   n)    DatumGetByteaP(PG_GETARG_DATUM(n))

Definition at line 335 of file fmgr.h.

◆ PG_GETARG_BYTEA_P_COPY

#define PG_GETARG_BYTEA_P_COPY (   n)    DatumGetByteaPCopy(PG_GETARG_DATUM(n))

Definition at line 314 of file fmgr.h.

◆ PG_GETARG_BYTEA_P_SLICE

#define PG_GETARG_BYTEA_P_SLICE (   n,
  a,
  b 
)    DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)

Definition at line 320 of file fmgr.h.

◆ PG_GETARG_BYTEA_PP

#define PG_GETARG_BYTEA_PP (   n)    DatumGetByteaPP(PG_GETARG_DATUM(n))

Definition at line 308 of file fmgr.h.

◆ PG_GETARG_CHAR

#define PG_GETARG_CHAR (   n)    DatumGetChar(PG_GETARG_DATUM(n))

Definition at line 273 of file fmgr.h.

◆ PG_GETARG_CSTRING

#define PG_GETARG_CSTRING (   n)    DatumGetCString(PG_GETARG_DATUM(n))

Definition at line 277 of file fmgr.h.

◆ PG_GETARG_DATUM

#define PG_GETARG_DATUM (   n)    (fcinfo->args[n].value)

Definition at line 268 of file fmgr.h.

◆ PG_GETARG_FLOAT4

#define PG_GETARG_FLOAT4 (   n)    DatumGetFloat4(PG_GETARG_DATUM(n))

Definition at line 281 of file fmgr.h.

◆ PG_GETARG_FLOAT8

#define PG_GETARG_FLOAT8 (   n)    DatumGetFloat8(PG_GETARG_DATUM(n))

Definition at line 282 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER

#define PG_GETARG_HEAPTUPLEHEADER (   n)    DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))

Definition at line 312 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER_COPY

#define PG_GETARG_HEAPTUPLEHEADER_COPY (   n)    DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))

Definition at line 318 of file fmgr.h.

◆ PG_GETARG_INT16

#define PG_GETARG_INT16 (   n)    DatumGetInt16(PG_GETARG_DATUM(n))

Definition at line 271 of file fmgr.h.

◆ PG_GETARG_INT32

#define PG_GETARG_INT32 (   n)    DatumGetInt32(PG_GETARG_DATUM(n))

Definition at line 269 of file fmgr.h.

◆ PG_GETARG_INT64

#define PG_GETARG_INT64 (   n)    DatumGetInt64(PG_GETARG_DATUM(n))

Definition at line 283 of file fmgr.h.

◆ PG_GETARG_NAME

#define PG_GETARG_NAME (   n)    DatumGetName(PG_GETARG_DATUM(n))

Definition at line 278 of file fmgr.h.

◆ PG_GETARG_OID

#define PG_GETARG_OID (   n)    DatumGetObjectId(PG_GETARG_DATUM(n))

Definition at line 275 of file fmgr.h.

◆ PG_GETARG_POINTER

#define PG_GETARG_POINTER (   n)    DatumGetPointer(PG_GETARG_DATUM(n))

Definition at line 276 of file fmgr.h.

◆ PG_GETARG_RAW_VARLENA_P

#define PG_GETARG_RAW_VARLENA_P (   n)    ((struct varlena *) PG_GETARG_POINTER(n))

Definition at line 285 of file fmgr.h.

◆ PG_GETARG_TEXT_P

#define PG_GETARG_TEXT_P (   n)    DatumGetTextP(PG_GETARG_DATUM(n))

Definition at line 336 of file fmgr.h.

◆ PG_GETARG_TEXT_P_COPY

#define PG_GETARG_TEXT_P_COPY (   n)    DatumGetTextPCopy(PG_GETARG_DATUM(n))

Definition at line 315 of file fmgr.h.

◆ PG_GETARG_TEXT_P_SLICE

#define PG_GETARG_TEXT_P_SLICE (   n,
  a,
  b 
)    DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)

Definition at line 321 of file fmgr.h.

◆ PG_GETARG_TEXT_PP

#define PG_GETARG_TEXT_PP (   n)    DatumGetTextPP(PG_GETARG_DATUM(n))

Definition at line 309 of file fmgr.h.

◆ PG_GETARG_TRANSACTIONID

#define PG_GETARG_TRANSACTIONID (   n)    DatumGetTransactionId(PG_GETARG_DATUM(n))

Definition at line 279 of file fmgr.h.

◆ PG_GETARG_UINT16

#define PG_GETARG_UINT16 (   n)    DatumGetUInt16(PG_GETARG_DATUM(n))

Definition at line 272 of file fmgr.h.

◆ PG_GETARG_UINT32

#define PG_GETARG_UINT32 (   n)    DatumGetUInt32(PG_GETARG_DATUM(n))

Definition at line 270 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P

#define PG_GETARG_VARCHAR_P (   n)    DatumGetVarCharP(PG_GETARG_DATUM(n))

Definition at line 338 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P_COPY

#define PG_GETARG_VARCHAR_P_COPY (   n)    DatumGetVarCharPCopy(PG_GETARG_DATUM(n))

Definition at line 317 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P_SLICE

#define PG_GETARG_VARCHAR_P_SLICE (   n,
  a,
  b 
)    DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)

Definition at line 323 of file fmgr.h.

◆ PG_GETARG_VARCHAR_PP

#define PG_GETARG_VARCHAR_PP (   n)    DatumGetVarCharPP(PG_GETARG_DATUM(n))

Definition at line 311 of file fmgr.h.

◆ PG_GETARG_VARLENA_P

#define PG_GETARG_VARLENA_P (   n)    PG_DETOAST_DATUM(PG_GETARG_DATUM(n))

Definition at line 287 of file fmgr.h.

◆ PG_GETARG_VARLENA_PP

#define PG_GETARG_VARLENA_PP (   n)    PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))

Definition at line 289 of file fmgr.h.

◆ PG_HAS_OPCLASS_OPTIONS

#define PG_HAS_OPCLASS_OPTIONS ( )    has_fn_opclass_options(fcinfo->flinfo)

Definition at line 341 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME

#define PG_MAGIC_FUNCTION_NAME   Pg_magic_func

Definition at line 496 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME_STRING

#define PG_MAGIC_FUNCTION_NAME_STRING   "Pg_magic_func"

Definition at line 497 of file fmgr.h.

◆ PG_MODULE_MAGIC

#define PG_MODULE_MAGIC
Value:
const Pg_magic_struct * \
PG_MAGIC_FUNCTION_NAME(void) \
{ \
static const Pg_magic_struct Pg_magic_data = PG_MODULE_MAGIC_DATA; \
return &Pg_magic_data; \
} \
extern int no_such_variable
#define PG_MODULE_MAGIC_DATA
Definition: fmgr.h:476
#define PG_MAGIC_FUNCTION_NAME
Definition: fmgr.h:496

Definition at line 499 of file fmgr.h.

◆ PG_MODULE_MAGIC_DATA

#define PG_MODULE_MAGIC_DATA
Value:
{ \
sizeof(Pg_magic_struct), \
PG_VERSION_NUM / 100, \
FUNC_MAX_ARGS, \
INDEX_MAX_KEYS, \
NAMEDATALEN, \
FLOAT8PASSBYVAL, \
FMGR_ABI_EXTRA, \
}

Definition at line 476 of file fmgr.h.

◆ PG_NARGS

#define PG_NARGS ( )    (fcinfo->nargs)

Definition at line 203 of file fmgr.h.

◆ PG_RETURN_BOOL

#define PG_RETURN_BOOL (   x)    return BoolGetDatum(x)

Definition at line 359 of file fmgr.h.

◆ PG_RETURN_BPCHAR_P

#define PG_RETURN_BPCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 373 of file fmgr.h.

◆ PG_RETURN_BYTEA_P

#define PG_RETURN_BYTEA_P (   x)    PG_RETURN_POINTER(x)

Definition at line 371 of file fmgr.h.

◆ PG_RETURN_CHAR

#define PG_RETURN_CHAR (   x)    return CharGetDatum(x)

Definition at line 358 of file fmgr.h.

◆ PG_RETURN_CSTRING

#define PG_RETURN_CSTRING (   x)    return CStringGetDatum(x)

Definition at line 362 of file fmgr.h.

◆ PG_RETURN_DATUM

#define PG_RETURN_DATUM (   x)    return (x)

Definition at line 353 of file fmgr.h.

◆ PG_RETURN_FLOAT4

#define PG_RETURN_FLOAT4 (   x)    return Float4GetDatum(x)

Definition at line 366 of file fmgr.h.

◆ PG_RETURN_FLOAT8

#define PG_RETURN_FLOAT8 (   x)    return Float8GetDatum(x)

Definition at line 367 of file fmgr.h.

◆ PG_RETURN_HEAPTUPLEHEADER

#define PG_RETURN_HEAPTUPLEHEADER (   x)    return HeapTupleHeaderGetDatum(x)

Definition at line 375 of file fmgr.h.

◆ PG_RETURN_INT16

#define PG_RETURN_INT16 (   x)    return Int16GetDatum(x)

Definition at line 356 of file fmgr.h.

◆ PG_RETURN_INT32

#define PG_RETURN_INT32 (   x)    return Int32GetDatum(x)

Definition at line 354 of file fmgr.h.

◆ PG_RETURN_INT64

#define PG_RETURN_INT64 (   x)    return Int64GetDatum(x)

Definition at line 368 of file fmgr.h.

◆ PG_RETURN_NAME

#define PG_RETURN_NAME (   x)    return NameGetDatum(x)

Definition at line 363 of file fmgr.h.

◆ PG_RETURN_NULL

#define PG_RETURN_NULL ( )     do { fcinfo->isnull = true; return (Datum) 0; } while (0)

Definition at line 345 of file fmgr.h.

◆ PG_RETURN_OID

#define PG_RETURN_OID (   x)    return ObjectIdGetDatum(x)

Definition at line 360 of file fmgr.h.

◆ PG_RETURN_POINTER

#define PG_RETURN_POINTER (   x)    return PointerGetDatum(x)

Definition at line 361 of file fmgr.h.

◆ PG_RETURN_TEXT_P

#define PG_RETURN_TEXT_P (   x)    PG_RETURN_POINTER(x)

Definition at line 372 of file fmgr.h.

◆ PG_RETURN_TRANSACTIONID

#define PG_RETURN_TRANSACTIONID (   x)    return TransactionIdGetDatum(x)

Definition at line 364 of file fmgr.h.

◆ PG_RETURN_UINT16

#define PG_RETURN_UINT16 (   x)    return UInt16GetDatum(x)

Definition at line 357 of file fmgr.h.

◆ PG_RETURN_UINT32

#define PG_RETURN_UINT32 (   x)    return UInt32GetDatum(x)

Definition at line 355 of file fmgr.h.

◆ PG_RETURN_UINT64

#define PG_RETURN_UINT64 (   x)    return UInt64GetDatum(x)

Definition at line 369 of file fmgr.h.

◆ PG_RETURN_VARCHAR_P

#define PG_RETURN_VARCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 374 of file fmgr.h.

◆ PG_RETURN_VOID

#define PG_RETURN_VOID ( )    return (Datum) 0

Definition at line 349 of file fmgr.h.

◆ SizeForFunctionCallInfo

#define SizeForFunctionCallInfo (   nargs)
Value:

Definition at line 102 of file fmgr.h.

Typedef Documentation

◆ fmAggrefPtr

typedef struct Aggref* fmAggrefPtr

Definition at line 23 of file fmgr.h.

◆ fmExprContextCallbackFunction

typedef void(* fmExprContextCallbackFunction) (Datum arg)

Definition at line 26 of file fmgr.h.

◆ fmgr_hook_type

typedef void(* fmgr_hook_type) (FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg)

Definition at line 791 of file fmgr.h.

◆ FmgrHookEventType

◆ FmgrInfo

typedef struct FmgrInfo FmgrInfo

◆ fmNodePtr

typedef struct Node* fmNodePtr

Definition at line 22 of file fmgr.h.

◆ fmStringInfo

typedef struct StringInfoData* fmStringInfo

Definition at line 29 of file fmgr.h.

◆ FunctionCallInfo

Definition at line 38 of file fmgr.h.

◆ FunctionCallInfoBaseData

◆ needs_fmgr_hook_type

typedef bool(* needs_fmgr_hook_type) (Oid fn_oid)

Definition at line 789 of file fmgr.h.

◆ PGFInfoFunction

typedef const Pg_finfo_record*(* PGFInfoFunction) (void)

Definition at line 401 of file fmgr.h.

◆ PGFunction

typedef Datum(* PGFunction) (FunctionCallInfo fcinfo)

Definition at line 40 of file fmgr.h.

◆ PGModuleMagicFunction

typedef const Pg_magic_struct*(* PGModuleMagicFunction) (void)

Definition at line 494 of file fmgr.h.

Enumeration Type Documentation

◆ FmgrHookEventType

Enumerator
FHET_START 
FHET_END 
FHET_ABORT 

Definition at line 782 of file fmgr.h.

783 {
784  FHET_START,
785  FHET_END,
786  FHET_ABORT
FmgrHookEventType
Definition: fmgr.h:783
@ FHET_END
Definition: fmgr.h:785
@ FHET_ABORT
Definition: fmgr.h:786
@ FHET_START
Definition: fmgr.h:784

Function Documentation

◆ _PG_fini()

void _PG_fini ( void  )

Definition at line 41 of file ldap_password_func.c.

42 {
43  /* do nothing yet */
44 }

◆ _PG_init()

PGDLLEXPORT void _PG_init ( void  )

Definition at line 54 of file auth_delay.c.

55 {
56  /* Define custom GUC variables */
57  DefineCustomIntVariable("auth_delay.milliseconds",
58  "Milliseconds to delay before reporting authentication failure",
59  NULL,
61  0,
62  0, INT_MAX / 1000,
63  PGC_SIGHUP,
65  NULL,
66  NULL,
67  NULL);
68 
69  MarkGUCPrefixReserved("auth_delay");
70 
71  /* Install Hooks */
74 }
ClientAuthentication_hook_type ClientAuthentication_hook
Definition: auth.c:231
static void auth_delay_checks(Port *port, int status)
Definition: auth_delay.c:33
static int auth_delay_milliseconds
Definition: auth_delay.c:24
static ClientAuthentication_hook_type original_client_auth_hook
Definition: auth_delay.c:27
void MarkGUCPrefixReserved(const char *className)
Definition: guc.c:5105
void DefineCustomIntVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, int minValue, int maxValue, GucContext context, int flags, GucIntCheckHook check_hook, GucIntAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:4984
#define GUC_UNIT_MS
Definition: guc.h:232
@ PGC_SIGHUP
Definition: guc.h:71

References AccessExclusiveLock, add_int_reloption(), add_reloption_kind(), apw_start_leader_worker(), archive_directory, AssertVariableIsOfType, auth_delay_checks(), auth_delay_milliseconds, auto_explain_log_analyze, auto_explain_log_buffers, auto_explain_log_format, auto_explain_log_level, auto_explain_log_min_duration, auto_explain_log_nested_statements, auto_explain_log_parameter_max_length, auto_explain_log_settings, auto_explain_log_timing, auto_explain_log_triggers, auto_explain_log_verbose, auto_explain_log_wal, auto_explain_sample_rate, autoprewarm, autoprewarm_interval, autoprewarm_shmem_request(), BaseBackupAddTarget(), BackgroundWorker::bgw_flags, BackgroundWorker::bgw_function_name, BackgroundWorker::bgw_library_name, BackgroundWorker::bgw_main_arg, BGW_MAXLEN, BackgroundWorker::bgw_name, BGW_NEVER_RESTART, BackgroundWorker::bgw_notify_pid, BackgroundWorker::bgw_restart_time, BackgroundWorker::bgw_start_time, BackgroundWorker::bgw_type, BGWORKER_BACKEND_DATABASE_CONNECTION, BGWORKER_SHMEM_ACCESS, BgWorkerStart_RecoveryFinished, bl_relopt_kind, bl_relopt_tab, buf, check_archive_directory(), check_password(), check_password_hook, ClientAuthentication_hook, create_reloptions_table(), DEFAULT_BLOOM_BITS, DEFAULT_BLOOM_LENGTH, DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), delay_execution_planner(), dummy_object_relabel(), EAN13_index, EAN13_range, elog(), EnableQueryId(), HASHCTL::entrysize, ereport, errcode(), errdetail(), errmsg(), ERROR, ExecutorCheckPerms_hook, ExecutorEnd_hook, ExecutorFinish_hook, ExecutorRun_hook, ExecutorStart_hook, explain_ExecutorEnd(), explain_ExecutorFinish(), explain_ExecutorRun(), explain_ExecutorStart(), EXPLAIN_FORMAT_TEXT, find_rendezvous_variable(), format_options, gettext_noop, GUC_LIST_INPUT, GUC_NOT_IN_SAMPLE, GUC_UNIT_BYTE, GUC_UNIT_MS, GUC_UNIT_S, HASH_BLOBS, hash_create(), HASH_ELEM, hstoreCheckKeyLen, hstoreCheckKeyLen_p, hstoreCheckValLen, hstoreCheckValLen_p, hstorePairs, hstorePairs_p, hstoreUniquePairs, hstoreUniquePairs_p, hstoreUpgrade, hstoreUpgrade_p, i, INDEX_MAX_KEYS, Int32GetDatum(), ISBN_index, ISBN_range, ISMN_index, ISMN_range, ISN_DEBUG, ISSN_index, ISSN_range, IsUnderPostmaster, HASHCTL::keysize, ldap_password_hook, load_external_function(), LOG, loglevel_options, MarkGUCPrefixReserved(), MAX_BLOOM_BITS, MAX_BLOOM_LENGTH, MemoryContextStrdup(), next_exec_check_perms_hook, next_object_access_hook, next_object_access_hook_str, next_ProcessUtility_hook, object_access_hook, object_access_hook_str, relopt_parse_elt::offset, openssl_tls_init_hook, relopt_parse_elt::optname, relopt_parse_elt::opttype, original_client_auth_hook, pg_bindtextdomain(), PGC_POSTMASTER, PGC_SIGHUP, PGC_SUSET, PGC_USERSET, pgfdw_application_name, pgss_ExecutorEnd(), pgss_ExecutorFinish(), pgss_ExecutorRun(), pgss_ExecutorStart(), pgss_max, pgss_planner(), pgss_post_parse_analyze(), pgss_ProcessUtility(), pgss_save, pgss_shmem_request(), pgss_shmem_startup(), pgss_track, pgss_track_planning, PGSS_TRACK_TOP, pgss_track_utility, planner_hook, plperl_held_interp, plperl_init_interp(), plperl_interp_hash, plperl_on_init, plperl_on_plperl_init, plperl_on_plperlu_init, plperl_opmask, plperl_proc_hash, plperl_use_strict, plpgsql_check_asserts, plpgsql_extra_checks_check_hook(), plpgsql_extra_errors_assign_hook(), plpgsql_extra_errors_string, plpgsql_extra_warnings_assign_hook(), plpgsql_extra_warnings_string, plpgsql_HashTableInit(), plpgsql_plugin_ptr, plpgsql_print_strict_params, PLPGSQL_RESOLVE_ERROR, plpgsql_subxact_cb(), plpgsql_variable_conflict, plpgsql_xact_cb(), plpython_version_bitmask, plpython_version_bitmask_ptr, pltcl_AlertNotifier(), pltcl_CreateFileHandler(), pltcl_DeleteFileHandler(), pltcl_FinalizeNotifier(), pltcl_hold_interp, pltcl_InitNotifier(), pltcl_interp_htab, pltcl_pm_init_done, pltcl_proc_htab, pltcl_ServiceModeHook(), pltcl_SetTimer(), pltcl_start_proc, pltcl_WaitForEvent(), pltclu_start_proc, PLy_elog_impl(), PLy_elog_impl_p, PLyObject_AsString, PLyObject_AsString_p, PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_p, post_parse_analyze_hook, post_planning_lock_id, PQWalReceiverFunctions, prev_check_password_hook, prev_ExecutorEnd, prev_ExecutorFinish, prev_ExecutorRun, prev_ExecutorStart, prev_planner_hook, prev_post_parse_analyze_hook, prev_ProcessUtility, prev_shmem_request_hook, prev_shmem_startup_hook, process_shared_preload_libraries_in_progress, ProcessUtility_hook, register_label_provider(), RegisterBackgroundWorker(), RegisterCustomRmgr(), RegisterSubXactCallback(), RegisterXactCallback(), REGRESS_audit, REGRESS_deny_alter_system, REGRESS_deny_exec_perms, REGRESS_deny_object_access, REGRESS_deny_set_variable, REGRESS_deny_utility_commands, REGRESS_exec_check_perms(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), REGRESS_suset_variable1, REGRESS_suset_variable2, REGRESS_userset_variable1, REGRESS_userset_variable2, REGRESS_utility_command(), RELOPT_TYPE_INT, RM_TESTCUSTOMRMGRS_ID, rot13_passphrase(), row_security_policy_hook_permissive, row_security_policy_hook_restrictive, sepgsql_avc_init(), sepgsql_context_info, sepgsql_debug_audit, sepgsql_exec_check_perms(), sepgsql_init_client_label(), SEPGSQL_LABEL_TAG, SEPGSQL_MODE_DISABLED, sepgsql_object_access(), sepgsql_object_relabel(), sepgsql_permissive, sepgsql_set_mode(), sepgsql_utility_command(), set_rot13(), shell_check_detail(), shell_command, shell_get_sink(), shell_required_role, shmem_request_hook, shmem_startup_hook, similarity_threshold, snprintf, sprintf, ssl_passphrase, strict_word_similarity_threshold, superuser_param, test_rls_hooks_permissive(), test_rls_hooks_restrictive(), test_slru_shmem_request(), test_slru_shmem_startup(), testcustomrmgrs_rmgr, TEXTDOMAIN, TopMemoryContext, track_options, UPC_index, UPC_range, user_param, variable_conflict_options, WalReceiverFunctions, and word_similarity_threshold.

◆ AggCheckCallContext()

int AggCheckCallContext ( FunctionCallInfo  fcinfo,
MemoryContext aggcontext 
)

Definition at line 4514 of file nodeAgg.c.

4515 {
4516  if (fcinfo->context && IsA(fcinfo->context, AggState))
4517  {
4518  if (aggcontext)
4519  {
4520  AggState *aggstate = ((AggState *) fcinfo->context);
4521  ExprContext *cxt = aggstate->curaggcontext;
4522 
4523  *aggcontext = cxt->ecxt_per_tuple_memory;
4524  }
4525  return AGG_CONTEXT_AGGREGATE;
4526  }
4527  if (fcinfo->context && IsA(fcinfo->context, WindowAggState))
4528  {
4529  if (aggcontext)
4530  *aggcontext = ((WindowAggState *) fcinfo->context)->curaggcontext;
4531  return AGG_CONTEXT_WINDOW;
4532  }
4533 
4534  /* this is just to prevent "uninitialized variable" warnings */
4535  if (aggcontext)
4536  *aggcontext = NULL;
4537  return 0;
4538 }
#define AGG_CONTEXT_WINDOW
Definition: fmgr.h:762
#define AGG_CONTEXT_AGGREGATE
Definition: fmgr.h:761
#define IsA(nodeptr, _type_)
Definition: nodes.h:179
ExprContext * curaggcontext
Definition: execnodes.h:2380
MemoryContext ecxt_per_tuple_memory
Definition: execnodes.h:257
fmNodePtr context
Definition: fmgr.h:88

References AGG_CONTEXT_AGGREGATE, AGG_CONTEXT_WINDOW, FunctionCallInfoBaseData::context, AggState::curaggcontext, ExprContext::ecxt_per_tuple_memory, and IsA.

Referenced by array_agg_array_combine(), array_agg_array_deserialize(), array_agg_array_finalfn(), array_agg_array_serialize(), array_agg_array_transfn(), array_agg_combine(), array_agg_deserialize(), array_agg_finalfn(), array_agg_serialize(), array_agg_transfn(), bytea_string_agg_finalfn(), fetch_array_arg_replace_nulls(), float4_accum(), float8_accum(), float8_combine(), float8_regr_accum(), float8_regr_combine(), hypothetical_dense_rank_final(), hypothetical_rank_common(), int2_avg_accum(), int2_avg_accum_inv(), int2_sum(), int4_avg_accum(), int4_avg_accum_inv(), int4_avg_combine(), int4_sum(), int8_avg_combine(), int8_avg_deserialize(), int8_avg_serialize(), int8dec(), int8inc(), json_agg_finalfn(), json_agg_transfn(), json_object_agg_finalfn(), json_object_agg_transfn(), jsonb_agg_finalfn(), jsonb_agg_transfn(), jsonb_object_agg_finalfn(), jsonb_object_agg_transfn(), makeBoolAggState(), makeNumericAggState(), makeStringAggState(), mode_final(), multirange_agg_transfn(), multirange_intersect_agg_transfn(), numeric_avg_combine(), numeric_avg_deserialize(), numeric_avg_serialize(), numeric_combine(), numeric_deserialize(), numeric_poly_combine(), numeric_poly_deserialize(), numeric_poly_serialize(), numeric_serialize(), ordered_set_startup(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), percentile_disc_multi_final(), range_agg_finalfn(), range_agg_transfn(), range_intersect_agg_transfn(), string_agg_combine(), string_agg_deserialize(), string_agg_finalfn(), and string_agg_serialize().

◆ AggGetAggref()

fmAggrefPtr AggGetAggref ( FunctionCallInfo  fcinfo)

Definition at line 4558 of file nodeAgg.c.

4559 {
4560  if (fcinfo->context && IsA(fcinfo->context, AggState))
4561  {
4562  AggState *aggstate = (AggState *) fcinfo->context;
4563  AggStatePerAgg curperagg;
4564  AggStatePerTrans curpertrans;
4565 
4566  /* check curperagg (valid when in a final function) */
4567  curperagg = aggstate->curperagg;
4568 
4569  if (curperagg)
4570  return curperagg->aggref;
4571 
4572  /* check curpertrans (valid when in a transition function) */
4573  curpertrans = aggstate->curpertrans;
4574 
4575  if (curpertrans)
4576  return curpertrans->aggref;
4577  }
4578  return NULL;
4579 }
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77
Aggref * aggref
Definition: nodeAgg.h:44
AggStatePerTrans curpertrans
Definition: execnodes.h:2383
AggStatePerAgg curperagg
Definition: execnodes.h:2381

References AggStatePerTransData::aggref, FunctionCallInfoBaseData::context, AggState::curperagg, AggState::curpertrans, if(), and IsA.

Referenced by ordered_set_startup().

◆ AggGetTempMemoryContext()

MemoryContext AggGetTempMemoryContext ( FunctionCallInfo  fcinfo)

Definition at line 4592 of file nodeAgg.c.

4593 {
4594  if (fcinfo->context && IsA(fcinfo->context, AggState))
4595  {
4596  AggState *aggstate = (AggState *) fcinfo->context;
4597 
4598  return aggstate->tmpcontext->ecxt_per_tuple_memory;
4599  }
4600  return NULL;
4601 }
ExprContext * tmpcontext
Definition: execnodes.h:2378

References FunctionCallInfoBaseData::context, ExprContext::ecxt_per_tuple_memory, IsA, and AggState::tmpcontext.

◆ AggRegisterCallback()

void AggRegisterCallback ( FunctionCallInfo  fcinfo,
fmExprContextCallbackFunction  func,
Datum  arg 
)

Definition at line 4657 of file nodeAgg.c.

4660 {
4661  if (fcinfo->context && IsA(fcinfo->context, AggState))
4662  {
4663  AggState *aggstate = (AggState *) fcinfo->context;
4664  ExprContext *cxt = aggstate->curaggcontext;
4665 
4666  RegisterExprContextCallback(cxt, func, arg);
4667 
4668  return;
4669  }
4670  elog(ERROR, "aggregate function cannot register a callback in this context");
4671 }
#define ERROR
Definition: elog.h:39
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition: execUtils.c:928
void * arg

References arg, FunctionCallInfoBaseData::context, AggState::curaggcontext, elog(), ERROR, IsA, and RegisterExprContextCallback().

Referenced by ordered_set_startup().

◆ AggStateIsShared()

bool AggStateIsShared ( FunctionCallInfo  fcinfo)

Definition at line 4618 of file nodeAgg.c.

4619 {
4620  if (fcinfo->context && IsA(fcinfo->context, AggState))
4621  {
4622  AggState *aggstate = (AggState *) fcinfo->context;
4623  AggStatePerAgg curperagg;
4624  AggStatePerTrans curpertrans;
4625 
4626  /* check curperagg (valid when in a final function) */
4627  curperagg = aggstate->curperagg;
4628 
4629  if (curperagg)
4630  return aggstate->pertrans[curperagg->transno].aggshared;
4631 
4632  /* check curpertrans (valid when in a transition function) */
4633  curpertrans = aggstate->curpertrans;
4634 
4635  if (curpertrans)
4636  return curpertrans->aggshared;
4637  }
4638  return true;
4639 }
AggStatePerTrans pertrans
Definition: execnodes.h:2375

References AggStatePerTransData::aggshared, FunctionCallInfoBaseData::context, AggState::curperagg, AggState::curpertrans, if(), IsA, and AggState::pertrans.

Referenced by ordered_set_startup().

◆ CallerFInfoFunctionCall1()

Datum CallerFInfoFunctionCall1 ( PGFunction  func,
FmgrInfo flinfo,
Oid  collation,
Datum  arg1 
)

Definition at line 1052 of file fmgr.c.

1053 {
1054  LOCAL_FCINFO(fcinfo, 1);
1055  Datum result;
1056 
1057  InitFunctionCallInfoData(*fcinfo, flinfo, 1, collation, NULL, NULL);
1058 
1059  fcinfo->args[0].value = arg1;
1060  fcinfo->args[0].isnull = false;
1061 
1062  result = (*func) (fcinfo);
1063 
1064  /* Check for null result, since caller is clearly not expecting one */
1065  if (fcinfo->isnull)
1066  elog(ERROR, "function %p returned NULL", (void *) func);
1067 
1068  return result;
1069 }
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
Definition: fmgr.h:150
#define LOCAL_FCINFO(name, nargs)
Definition: fmgr.h:110

References elog(), ERROR, fmgr_security_definer_cache::flinfo, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ CallerFInfoFunctionCall2()

Datum CallerFInfoFunctionCall2 ( PGFunction  func,
FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2 
)

Definition at line 1072 of file fmgr.c.

1073 {
1074  LOCAL_FCINFO(fcinfo, 2);
1075  Datum result;
1076 
1077  InitFunctionCallInfoData(*fcinfo, flinfo, 2, collation, NULL, NULL);
1078 
1079  fcinfo->args[0].value = arg1;
1080  fcinfo->args[0].isnull = false;
1081  fcinfo->args[1].value = arg2;
1082  fcinfo->args[1].isnull = false;
1083 
1084  result = (*func) (fcinfo);
1085 
1086  /* Check for null result, since caller is clearly not expecting one */
1087  if (fcinfo->isnull)
1088  elog(ERROR, "function %p returned NULL", (void *) func);
1089 
1090  return result;
1091 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by gbt_enumge(), gbt_enumgt(), gbt_enumkey_cmp(), gbt_enumle(), gbt_enumlt(), gin_btree_compare_prefix(), and gin_enum_cmp().

◆ CheckFunctionValidatorAccess()

bool CheckFunctionValidatorAccess ( Oid  validatorOid,
Oid  functionOid 
)

Definition at line 2132 of file fmgr.c.

2133 {
2134  HeapTuple procTup;
2135  HeapTuple langTup;
2136  Form_pg_proc procStruct;
2137  Form_pg_language langStruct;
2138  AclResult aclresult;
2139 
2140  /*
2141  * Get the function's pg_proc entry. Throw a user-facing error for bad
2142  * OID, because validators can be called with user-specified OIDs.
2143  */
2144  procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionOid));
2145  if (!HeapTupleIsValid(procTup))
2146  ereport(ERROR,
2147  (errcode(ERRCODE_UNDEFINED_FUNCTION),
2148  errmsg("function with OID %u does not exist", functionOid)));
2149  procStruct = (Form_pg_proc) GETSTRUCT(procTup);
2150 
2151  /*
2152  * Fetch pg_language entry to know if this is the correct validation
2153  * function for that pg_proc entry.
2154  */
2155  langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(procStruct->prolang));
2156  if (!HeapTupleIsValid(langTup))
2157  elog(ERROR, "cache lookup failed for language %u", procStruct->prolang);
2158  langStruct = (Form_pg_language) GETSTRUCT(langTup);
2159 
2160  if (langStruct->lanvalidator != validatorOid)
2161  ereport(ERROR,
2162  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
2163  errmsg("language validation function %u called for language %u instead of %u",
2164  validatorOid, procStruct->prolang,
2165  langStruct->lanvalidator)));
2166 
2167  /* first validate that we have permissions to use the language */
2168  aclresult = object_aclcheck(LanguageRelationId, procStruct->prolang, GetUserId(),
2169  ACL_USAGE);
2170  if (aclresult != ACLCHECK_OK)
2171  aclcheck_error(aclresult, OBJECT_LANGUAGE,
2172  NameStr(langStruct->lanname));
2173 
2174  /*
2175  * Check whether we are allowed to execute the function itself. If we can
2176  * execute it, there should be no possible side-effect of
2177  * compiling/validation that execution can't have.
2178  */
2179  aclresult = object_aclcheck(ProcedureRelationId, functionOid, GetUserId(), ACL_EXECUTE);
2180  if (aclresult != ACLCHECK_OK)
2181  aclcheck_error(aclresult, OBJECT_FUNCTION, NameStr(procStruct->proname));
2182 
2183  ReleaseSysCache(procTup);
2184  ReleaseSysCache(langTup);
2185 
2186  return true;
2187 }
AclResult
Definition: acl.h:182
@ ACLCHECK_OK
Definition: acl.h:183
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition: aclchk.c:2679
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
Definition: aclchk.c:3783
#define NameStr(name)
Definition: c.h:730
int errcode(int sqlerrcode)
Definition: elog.c:858
int errmsg(const char *fmt,...)
Definition: elog.c:1069
#define ereport(elevel,...)
Definition: elog.h:149
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define GETSTRUCT(TUP)
Definition: htup_details.h:653
Oid GetUserId(void)
Definition: miscinit.c:510
#define ACL_USAGE
Definition: parsenodes.h:91
@ OBJECT_LANGUAGE
Definition: parsenodes.h:1996
@ OBJECT_FUNCTION
Definition: parsenodes.h:1994
#define ACL_EXECUTE
Definition: parsenodes.h:90
FormData_pg_language * Form_pg_language
Definition: pg_language.h:65
FormData_pg_proc * Form_pg_proc
Definition: pg_proc.h:136
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:865
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:817
@ PROCOID
Definition: syscache.h:79
@ LANGOID
Definition: syscache.h:68

References ACL_EXECUTE, ACL_USAGE, aclcheck_error(), ACLCHECK_OK, elog(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, GetUserId(), HeapTupleIsValid, LANGOID, NameStr, object_aclcheck(), OBJECT_FUNCTION, OBJECT_LANGUAGE, ObjectIdGetDatum(), PROCOID, ReleaseSysCache(), and SearchSysCache1().

Referenced by fmgr_c_validator(), fmgr_internal_validator(), fmgr_sql_validator(), plperl_validator(), plpgsql_validator(), and plpython3_validator().

◆ DirectFunctionCall1Coll()

Datum DirectFunctionCall1Coll ( PGFunction  func,
Oid  collation,
Datum  arg1 
)

Definition at line 779 of file fmgr.c.

780 {
781  LOCAL_FCINFO(fcinfo, 1);
782  Datum result;
783 
784  InitFunctionCallInfoData(*fcinfo, NULL, 1, collation, NULL, NULL);
785 
786  fcinfo->args[0].value = arg1;
787  fcinfo->args[0].isnull = false;
788 
789  result = (*func) (fcinfo);
790 
791  /* Check for null result, since caller is clearly not expecting one */
792  if (fcinfo->isnull)
793  elog(ERROR, "function %p returned NULL", (void *) func);
794 
795  return result;
796 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by Generic_Text_IC_like(), libpqrcv_create_slot(), and texthashfast().

◆ DirectFunctionCall2Coll()

Datum DirectFunctionCall2Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2 
)

Definition at line 799 of file fmgr.c.

800 {
801  LOCAL_FCINFO(fcinfo, 2);
802  Datum result;
803 
804  InitFunctionCallInfoData(*fcinfo, NULL, 2, collation, NULL, NULL);
805 
806  fcinfo->args[0].value = arg1;
807  fcinfo->args[0].isnull = false;
808  fcinfo->args[1].value = arg2;
809  fcinfo->args[1].isnull = false;
810 
811  result = (*func) (fcinfo);
812 
813  /* Check for null result, since caller is clearly not expecting one */
814  if (fcinfo->isnull)
815  elog(ERROR, "function %p returned NULL", (void *) func);
816 
817  return result;
818 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by gbt_bpcharcmp(), gbt_bpchareq(), gbt_bpcharge(), gbt_bpchargt(), gbt_bpcharle(), gbt_bpcharlt(), gbt_textcmp(), gbt_texteq(), gbt_textge(), gbt_textgt(), gbt_textle(), gbt_textlt(), spg_text_leaf_consistent(), text_isequal(), and texteqfast().

◆ DirectFunctionCall3Coll()

Datum DirectFunctionCall3Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3 
)

Definition at line 821 of file fmgr.c.

823 {
824  LOCAL_FCINFO(fcinfo, 3);
825  Datum result;
826 
827  InitFunctionCallInfoData(*fcinfo, NULL, 3, collation, NULL, NULL);
828 
829  fcinfo->args[0].value = arg1;
830  fcinfo->args[0].isnull = false;
831  fcinfo->args[1].value = arg2;
832  fcinfo->args[1].isnull = false;
833  fcinfo->args[2].value = arg3;
834  fcinfo->args[2].isnull = false;
835 
836  result = (*func) (fcinfo);
837 
838  /* Check for null result, since caller is clearly not expecting one */
839  if (fcinfo->isnull)
840  elog(ERROR, "function %p returned NULL", (void *) func);
841 
842  return result;
843 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by execute_extension_script().

◆ DirectFunctionCall4Coll()

Datum DirectFunctionCall4Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4 
)

Definition at line 846 of file fmgr.c.

848 {
849  LOCAL_FCINFO(fcinfo, 4);
850  Datum result;
851 
852  InitFunctionCallInfoData(*fcinfo, NULL, 4, collation, NULL, NULL);
853 
854  fcinfo->args[0].value = arg1;
855  fcinfo->args[0].isnull = false;
856  fcinfo->args[1].value = arg2;
857  fcinfo->args[1].isnull = false;
858  fcinfo->args[2].value = arg3;
859  fcinfo->args[2].isnull = false;
860  fcinfo->args[3].value = arg4;
861  fcinfo->args[3].isnull = false;
862 
863  result = (*func) (fcinfo);
864 
865  /* Check for null result, since caller is clearly not expecting one */
866  if (fcinfo->isnull)
867  elog(ERROR, "function %p returned NULL", (void *) func);
868 
869  return result;
870 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by execute_extension_script().

◆ DirectFunctionCall5Coll()

Datum DirectFunctionCall5Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5 
)

Definition at line 873 of file fmgr.c.

875 {
876  LOCAL_FCINFO(fcinfo, 5);
877  Datum result;
878 
879  InitFunctionCallInfoData(*fcinfo, NULL, 5, collation, NULL, NULL);
880 
881  fcinfo->args[0].value = arg1;
882  fcinfo->args[0].isnull = false;
883  fcinfo->args[1].value = arg2;
884  fcinfo->args[1].isnull = false;
885  fcinfo->args[2].value = arg3;
886  fcinfo->args[2].isnull = false;
887  fcinfo->args[3].value = arg4;
888  fcinfo->args[3].isnull = false;
889  fcinfo->args[4].value = arg5;
890  fcinfo->args[4].isnull = false;
891 
892  result = (*func) (fcinfo);
893 
894  /* Check for null result, since caller is clearly not expecting one */
895  if (fcinfo->isnull)
896  elog(ERROR, "function %p returned NULL", (void *) func);
897 
898  return result;
899 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by neqjoinsel().

◆ DirectFunctionCall6Coll()

Datum DirectFunctionCall6Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6 
)

Definition at line 902 of file fmgr.c.

905 {
906  LOCAL_FCINFO(fcinfo, 6);
907  Datum result;
908 
909  InitFunctionCallInfoData(*fcinfo, NULL, 6, collation, NULL, NULL);
910 
911  fcinfo->args[0].value = arg1;
912  fcinfo->args[0].isnull = false;
913  fcinfo->args[1].value = arg2;
914  fcinfo->args[1].isnull = false;
915  fcinfo->args[2].value = arg3;
916  fcinfo->args[2].isnull = false;
917  fcinfo->args[3].value = arg4;
918  fcinfo->args[3].isnull = false;
919  fcinfo->args[4].value = arg5;
920  fcinfo->args[4].isnull = false;
921  fcinfo->args[5].value = arg6;
922  fcinfo->args[5].isnull = false;
923 
924  result = (*func) (fcinfo);
925 
926  /* Check for null result, since caller is clearly not expecting one */
927  if (fcinfo->isnull)
928  elog(ERROR, "function %p returned NULL", (void *) func);
929 
930  return result;
931 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall7Coll()

Datum DirectFunctionCall7Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7 
)

Definition at line 934 of file fmgr.c.

937 {
938  LOCAL_FCINFO(fcinfo, 7);
939  Datum result;
940 
941  InitFunctionCallInfoData(*fcinfo, NULL, 7, collation, NULL, NULL);
942 
943  fcinfo->args[0].value = arg1;
944  fcinfo->args[0].isnull = false;
945  fcinfo->args[1].value = arg2;
946  fcinfo->args[1].isnull = false;
947  fcinfo->args[2].value = arg3;
948  fcinfo->args[2].isnull = false;
949  fcinfo->args[3].value = arg4;
950  fcinfo->args[3].isnull = false;
951  fcinfo->args[4].value = arg5;
952  fcinfo->args[4].isnull = false;
953  fcinfo->args[5].value = arg6;
954  fcinfo->args[5].isnull = false;
955  fcinfo->args[6].value = arg7;
956  fcinfo->args[6].isnull = false;
957 
958  result = (*func) (fcinfo);
959 
960  /* Check for null result, since caller is clearly not expecting one */
961  if (fcinfo->isnull)
962  elog(ERROR, "function %p returned NULL", (void *) func);
963 
964  return result;
965 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall8Coll()

Datum DirectFunctionCall8Coll ( PGFunction  func,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7,
Datum  arg8 
)

Definition at line 968 of file fmgr.c.

971 {
972  LOCAL_FCINFO(fcinfo, 8);
973  Datum result;
974 
975  InitFunctionCallInfoData(*fcinfo, NULL, 8, collation, NULL, NULL);
976 
977  fcinfo->args[0].value = arg1;
978  fcinfo->args[0].isnull = false;
979  fcinfo->args[1].value = arg2;
980  fcinfo->args[1].isnull = false;
981  fcinfo->args[2].value = arg3;
982  fcinfo->args[2].isnull = false;
983  fcinfo->args[3].value = arg4;
984  fcinfo->args[3].isnull = false;
985  fcinfo->args[4].value = arg5;
986  fcinfo->args[4].isnull = false;
987  fcinfo->args[5].value = arg6;
988  fcinfo->args[5].isnull = false;
989  fcinfo->args[6].value = arg7;
990  fcinfo->args[6].isnull = false;
991  fcinfo->args[7].value = arg8;
992  fcinfo->args[7].isnull = false;
993 
994  result = (*func) (fcinfo);
995 
996  /* Check for null result, since caller is clearly not expecting one */
997  if (fcinfo->isnull)
998  elog(ERROR, "function %p returned NULL", (void *) func);
999 
1000  return result;
1001 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall9Coll()

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 at line 1004 of file fmgr.c.

1008 {
1009  LOCAL_FCINFO(fcinfo, 9);
1010  Datum result;
1011 
1012  InitFunctionCallInfoData(*fcinfo, NULL, 9, collation, NULL, NULL);
1013 
1014  fcinfo->args[0].value = arg1;
1015  fcinfo->args[0].isnull = false;
1016  fcinfo->args[1].value = arg2;
1017  fcinfo->args[1].isnull = false;
1018  fcinfo->args[2].value = arg3;
1019  fcinfo->args[2].isnull = false;
1020  fcinfo->args[3].value = arg4;
1021  fcinfo->args[3].isnull = false;
1022  fcinfo->args[4].value = arg5;
1023  fcinfo->args[4].isnull = false;
1024  fcinfo->args[5].value = arg6;
1025  fcinfo->args[5].isnull = false;
1026  fcinfo->args[6].value = arg7;
1027  fcinfo->args[6].isnull = false;
1028  fcinfo->args[7].value = arg8;
1029  fcinfo->args[7].isnull = false;
1030  fcinfo->args[8].value = arg9;
1031  fcinfo->args[8].isnull = false;
1032 
1033  result = (*func) (fcinfo);
1034 
1035  /* Check for null result, since caller is clearly not expecting one */
1036  if (fcinfo->isnull)
1037  elog(ERROR, "function %p returned NULL", (void *) func);
1038 
1039  return result;
1040 }

References elog(), ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectInputFunctionCallSafe()

bool DirectInputFunctionCallSafe ( PGFunction  func,
char *  str,
Oid  typioparam,
int32  typmod,
fmNodePtr  escontext,
Datum result 
)

Definition at line 1627 of file fmgr.c.

1631 {
1632  LOCAL_FCINFO(fcinfo, 3);
1633 
1634  if (str == NULL)
1635  {
1636  *result = (Datum) 0; /* just return null result */
1637  return true;
1638  }
1639 
1640  InitFunctionCallInfoData(*fcinfo, NULL, 3, InvalidOid, escontext, NULL);
1641 
1642  fcinfo->args[0].value = CStringGetDatum(str);
1643  fcinfo->args[0].isnull = false;
1644  fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1645  fcinfo->args[1].isnull = false;
1646  fcinfo->args[2].value = Int32GetDatum(typmod);
1647  fcinfo->args[2].isnull = false;
1648 
1649  *result = (*func) (fcinfo);
1650 
1651  /* Result value is garbage, and could be null, if an error was reported */
1652  if (SOFT_ERROR_OCCURRED(escontext))
1653  return false;
1654 
1655  /* Otherwise, shouldn't get null result */
1656  if (fcinfo->isnull)
1657  elog(ERROR, "input function %p returned NULL", (void *) func);
1658 
1659  return true;
1660 }
#define SOFT_ERROR_OCCURRED(escontext)
Definition: miscnodes.h:52
static Datum CStringGetDatum(const char *X)
Definition: postgres.h:350
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:212
#define InvalidOid
Definition: postgres_ext.h:36

References CStringGetDatum(), elog(), ERROR, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), SOFT_ERROR_OCCURRED, and generate_unaccent_rules::str.

Referenced by jsonb_in_scalar(), parseNumericOid(), to_regclass(), to_regcollation(), to_regnamespace(), to_regoper(), to_regoperator(), to_regproc(), to_regprocedure(), to_regrole(), and to_regtype().

◆ EstimateLibraryStateSpace()

Size EstimateLibraryStateSpace ( void  )

Definition at line 654 of file dfmgr.c.

655 {
656  DynamicFileList *file_scanner;
657  Size size = 1;
658 
659  for (file_scanner = file_list;
660  file_scanner != NULL;
661  file_scanner = file_scanner->next)
662  size = add_size(size, strlen(file_scanner->filename) + 1);
663 
664  return size;
665 }
size_t Size
Definition: c.h:589
static DynamicFileList * file_list
Definition: dfmgr.c:66
Size add_size(Size s1, Size s2)
Definition: shmem.c:502
Definition: dfmgr.c:55
struct df_files * next
Definition: dfmgr.c:56
char filename[FLEXIBLE_ARRAY_MEMBER]
Definition: dfmgr.c:63

References add_size(), file_list, df_files::filename, and df_files::next.

Referenced by InitializeParallelDSM().

◆ fetch_finfo_record()

const Pg_finfo_record* fetch_finfo_record ( void *  filehandle,
const char *  funcname 
)

Definition at line 470 of file fmgr.c.

471 {
472  char *infofuncname;
473  PGFInfoFunction infofunc;
474  const Pg_finfo_record *inforec;
475 
476  infofuncname = psprintf("pg_finfo_%s", funcname);
477 
478  /* Try to look up the info function */
479  infofunc = (PGFInfoFunction) lookup_external_function(filehandle,
480  infofuncname);
481  if (infofunc == NULL)
482  {
483  ereport(ERROR,
484  (errcode(ERRCODE_UNDEFINED_FUNCTION),
485  errmsg("could not find function information for function \"%s\"",
486  funcname),
487  errhint("SQL-callable functions need an accompanying PG_FUNCTION_INFO_V1(funcname).")));
488  return NULL; /* silence compiler */
489  }
490 
491  /* Found, so call it */
492  inforec = (*infofunc) ();
493 
494  /* Validate result as best we can */
495  if (inforec == NULL)
496  elog(ERROR, "null result from info function \"%s\"", infofuncname);
497  switch (inforec->api_version)
498  {
499  case 1:
500  /* OK, no additional fields to validate */
501  break;
502  default:
503  ereport(ERROR,
504  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
505  errmsg("unrecognized API version %d reported by info function \"%s\"",
506  inforec->api_version, infofuncname)));
507  break;
508  }
509 
510  pfree(infofuncname);
511  return inforec;
512 }
void * lookup_external_function(void *filehandle, const char *funcname)
Definition: dfmgr.c:166
int errhint(const char *fmt,...)
Definition: elog.c:1316
const Pg_finfo_record *(* PGFInfoFunction)(void)
Definition: fmgr.h:401
void pfree(void *pointer)
Definition: mcxt.c:1436
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
int api_version
Definition: fmgr.h:396

References Pg_finfo_record::api_version, elog(), ereport, errcode(), errhint(), errmsg(), ERROR, funcname, lookup_external_function(), pfree(), and psprintf().

Referenced by fmgr_c_validator(), and fmgr_info_C_lang().

◆ find_rendezvous_variable()

void** find_rendezvous_variable ( const char *  varName)

Definition at line 616 of file dfmgr.c.

617 {
618  static HTAB *rendezvousHash = NULL;
619 
620  rendezvousHashEntry *hentry;
621  bool found;
622 
623  /* Create a hashtable if we haven't already done so in this process */
624  if (rendezvousHash == NULL)
625  {
626  HASHCTL ctl;
627 
628  ctl.keysize = NAMEDATALEN;
629  ctl.entrysize = sizeof(rendezvousHashEntry);
630  rendezvousHash = hash_create("Rendezvous variable hash",
631  16,
632  &ctl,
634  }
635 
636  /* Find or create the hashtable entry for this varName */
637  hentry = (rendezvousHashEntry *) hash_search(rendezvousHash,
638  varName,
639  HASH_ENTER,
640  &found);
641 
642  /* Initialize to NULL if first time */
643  if (!found)
644  hentry->varValue = NULL;
645 
646  return &hentry->varValue;
647 }
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition: dynahash.c:953
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
Definition: dynahash.c:350
#define HASH_STRINGS
Definition: hsearch.h:96
@ HASH_ENTER
Definition: hsearch.h:114
#define HASH_ELEM
Definition: hsearch.h:95
#define NAMEDATALEN
Size keysize
Definition: hsearch.h:75
Size entrysize
Definition: hsearch.h:76
Definition: dynahash.c:220
void * varValue
Definition: dfmgr.c:47

References HASHCTL::entrysize, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASH_STRINGS, HASHCTL::keysize, NAMEDATALEN, and rendezvousHashEntry::varValue.

Referenced by _PG_init().

◆ fmgr_info()

void fmgr_info ( Oid  functionId,
FmgrInfo finfo 
)

Definition at line 127 of file fmgr.c.

128 {
129  fmgr_info_cxt_security(functionId, finfo, CurrentMemoryContext, false);
130 }
static void fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, bool ignore_security)
Definition: fmgr.c:147
MemoryContext CurrentMemoryContext
Definition: mcxt.c:135

References CurrentMemoryContext, and fmgr_info_cxt_security().

Referenced by _bt_find_extreme_element(), _bt_sort_array_elements(), _sv_to_datum_finfo(), BeginCopyFrom(), brin_minmax_multi_summary_out(), brin_page_items(), build_pertrans_for_aggref(), call_pltcl_start_proc(), compute_distinct_stats(), create_foreign_modify(), DoCopyTo(), eqjoinsel_inner(), eqjoinsel_semi(), EventTriggerInvoke(), ExecBuildGroupingEqual(), ExecBuildParamSetEqual(), ExecCallTriggerFunc(), ExecEvalHashedScalarArrayOp(), ExecHashTableCreate(), ExecInitAgg(), ExecInitExprRec(), ExecInitFunc(), ExecInitMemoize(), ExecInitSubPlan(), ExecInitTableFuncScan(), ExecInitWindowAgg(), execTuplesHashPrepare(), ExecuteCallStmt(), fetch_fp_info(), generic_restriction_selectivity(), get_stats_slot_range(), gincost_pattern(), hash_array(), inet_mcv_join_sel(), initialize_peragg(), match_pattern_prefix(), mcv_get_match_bitmap(), networkjoinsel_semi(), networksel(), OidFunctionCall0Coll(), OidFunctionCall1Coll(), OidFunctionCall2Coll(), OidFunctionCall3Coll(), OidFunctionCall4Coll(), OidFunctionCall5Coll(), OidFunctionCall6Coll(), OidFunctionCall7Coll(), OidFunctionCall8Coll(), OidFunctionCall9Coll(), OidInputFunctionCall(), OidOutputFunctionCall(), OidReceiveFunctionCall(), OidSendFunctionCall(), patternsel_common(), pg_get_catalog_foreign_keys(), pg_stats_ext_mcvlist_items(), plperl_ref_from_pg_array(), prefix_selectivity(), prepare_query_params(), printtup_prepare_info(), scalararraysel(), scalarineqsel(), ScanKeyEntryInitialize(), ScanKeyInit(), text_format(), TupleDescGetAttInMetadata(), and var_eq_const().

◆ fmgr_info_copy()

void fmgr_info_copy ( FmgrInfo dstinfo,
FmgrInfo srcinfo,
MemoryContext  destcxt 
)

Definition at line 595 of file fmgr.c.

597 {
598  memcpy(dstinfo, srcinfo, sizeof(FmgrInfo));
599  dstinfo->fn_mcxt = destcxt;
600  dstinfo->fn_extra = NULL;
601 }
Definition: fmgr.h:57
void * fn_extra
Definition: fmgr.h:64
MemoryContext fn_mcxt
Definition: fmgr.h:65

References FmgrInfo::fn_extra, and FmgrInfo::fn_mcxt.

Referenced by bloom_get_procinfo(), bringetbitmap(), find_partition_scheme(), gistrescan(), inclusion_get_procinfo(), initBloomState(), initGinState(), initGISTstate(), minmax_multi_get_procinfo(), perform_pruning_base_step(), satisfies_hash_partition(), ScanKeyEntryInitializeWithInfo(), and spgbeginscan().

◆ fmgr_info_cxt()

◆ fmgr_internal_function()

Oid fmgr_internal_function ( const char *  proname)

Definition at line 610 of file fmgr.c.

611 {
612  const FmgrBuiltin *fbp = fmgr_lookupByName(proname);
613 
614  if (fbp == NULL)
615  return InvalidOid;
616  return fbp->foid;
617 }
static const FmgrBuiltin * fmgr_lookupByName(const char *name)
Definition: fmgr.c:101
NameData proname
Definition: pg_proc.h:35
Oid foid
Definition: fmgrtab.h:27

References fmgr_lookupByName(), FmgrBuiltin::foid, InvalidOid, and proname.

Referenced by fmgr_internal_validator().

◆ fmgr_symbol()

void fmgr_symbol ( Oid  functionId,
char **  mod,
char **  fn 
)

Definition at line 284 of file fmgr.c.

285 {
286  HeapTuple procedureTuple;
287  Form_pg_proc procedureStruct;
288  bool isnull;
289  Datum prosrcattr;
290  Datum probinattr;
291 
292  procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionId));
293  if (!HeapTupleIsValid(procedureTuple))
294  elog(ERROR, "cache lookup failed for function %u", functionId);
295  procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
296 
297  if (procedureStruct->prosecdef ||
298  !heap_attisnull(procedureTuple, Anum_pg_proc_proconfig, NULL) ||
299  FmgrHookIsNeeded(functionId))
300  {
301  *mod = NULL; /* core binary */
302  *fn = pstrdup("fmgr_security_definer");
303  ReleaseSysCache(procedureTuple);
304  return;
305  }
306 
307  /* see fmgr_info_cxt_security for the individual cases */
308  switch (procedureStruct->prolang)
309  {
310  case INTERNALlanguageId:
311  prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
312  Anum_pg_proc_prosrc, &isnull);
313  if (isnull)
314  elog(ERROR, "null prosrc");
315 
316  *mod = NULL; /* core binary */
317  *fn = TextDatumGetCString(prosrcattr);
318  break;
319 
320  case ClanguageId:
321  prosrcattr = SysCacheGetAttr(PROCOID, procedureTuple,
322  Anum_pg_proc_prosrc, &isnull);
323  if (isnull)
324  elog(ERROR, "null prosrc for C function %u", functionId);
325 
326  probinattr = SysCacheGetAttr(PROCOID, procedureTuple,
327  Anum_pg_proc_probin, &isnull);
328  if (isnull)
329  elog(ERROR, "null probin for C function %u", functionId);
330 
331  /*
332  * No need to check symbol presence / API version here, already
333  * checked in fmgr_info_cxt_security.
334  */
335  *mod = TextDatumGetCString(probinattr);
336  *fn = TextDatumGetCString(prosrcattr);
337  break;
338 
339  case SQLlanguageId:
340  *mod = NULL; /* core binary */
341  *fn = pstrdup("fmgr_sql");
342  break;
343 
344  default:
345  *mod = NULL;
346  *fn = NULL; /* unknown, pass pointer */
347  break;
348  }
349 
350  ReleaseSysCache(procedureTuple);
351 }
#define TextDatumGetCString(d)
Definition: builtins.h:95
#define FmgrHookIsNeeded(fn_oid)
Definition: fmgr.h:797
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
Definition: heaptuple.c:359
char * pstrdup(const char *in)
Definition: mcxt.c:1624
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1078
static void * fn(void *arg)

References elog(), ERROR, FmgrHookIsNeeded, fn(), GETSTRUCT, heap_attisnull(), HeapTupleIsValid, ObjectIdGetDatum(), PROCOID, pstrdup(), ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttr(), and TextDatumGetCString.

Referenced by llvm_function_reference().

◆ FunctionCall0Coll()

Datum FunctionCall0Coll ( FmgrInfo flinfo,
Oid  collation 
)

Definition at line 1099 of file fmgr.c.

1100 {
1101  LOCAL_FCINFO(fcinfo, 0);
1102  Datum result;
1103 
1104  InitFunctionCallInfoData(*fcinfo, flinfo, 0, collation, NULL, NULL);
1105 
1106  result = FunctionCallInvoke(fcinfo);
1107 
1108  /* Check for null result, since caller is clearly not expecting one */
1109  if (fcinfo->isnull)
1110  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1111 
1112  return result;
1113 }
#define FunctionCallInvoke(fcinfo)
Definition: fmgr.h:172
Oid fn_oid
Definition: fmgr.h:59

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by OidFunctionCall0Coll().

◆ FunctionCall1Coll()

Datum FunctionCall1Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1 
)

Definition at line 1116 of file fmgr.c.

1117 {
1118  LOCAL_FCINFO(fcinfo, 1);
1119  Datum result;
1120 
1121  InitFunctionCallInfoData(*fcinfo, flinfo, 1, collation, NULL, NULL);
1122 
1123  fcinfo->args[0].value = arg1;
1124  fcinfo->args[0].isnull = false;
1125 
1126  result = FunctionCallInvoke(fcinfo);
1127 
1128  /* Check for null result, since caller is clearly not expecting one */
1129  if (fcinfo->isnull)
1130  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1131 
1132  return result;
1133 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by _hash_datum2hashkey(), brin_bloom_add_value(), brin_bloom_consistent(), brin_inclusion_add_value(), element_hash(), ExecHashBuildSkewHash(), ExecHashGetHashValue(), gistCompressValues(), gistdentryinit(), gistFetchAtt(), hash_multirange(), hash_range(), MemoizeHash_hash(), OidFunctionCall1Coll(), signValue(), spgdoinsert(), and TupleHashTableHash_internal().

◆ FunctionCall2Coll()

Datum FunctionCall2Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2 
)

Definition at line 1136 of file fmgr.c.

1137 {
1138  LOCAL_FCINFO(fcinfo, 2);
1139  Datum result;
1140 
1141  InitFunctionCallInfoData(*fcinfo, flinfo, 2, collation, NULL, NULL);
1142 
1143  fcinfo->args[0].value = arg1;
1144  fcinfo->args[0].isnull = false;
1145  fcinfo->args[1].value = arg2;
1146  fcinfo->args[1].isnull = false;
1147 
1148  result = FunctionCallInvoke(fcinfo);
1149 
1150  /* Check for null result, since caller is clearly not expecting one */
1151  if (fcinfo->isnull)
1152  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1153 
1154  return result;
1155 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by _bt_check_rowcompare(), _bt_checkkeys(), _bt_compare(), _bt_compare_array_elements(), _bt_compare_scankey_args(), _bt_find_extreme_element(), _bt_keep_natts(), _hash_checkqual(), array_position_common(), array_positions(), AssertCheckExpandedRanges(), AssertCheckRanges(), brin_inclusion_add_value(), brin_inclusion_consistent(), brin_inclusion_union(), brin_minmax_add_value(), brin_minmax_consistent(), brin_minmax_multi_consistent(), brin_minmax_union(), build_distances(), call_subtype_diff(), cmpEntries(), compare_expanded_ranges(), compare_values(), compute_distinct_stats(), compute_partition_hash_value(), compute_range_stats(), create_range_bounds(), doPickSplit(), element_compare(), ExecEvalPreOrderedDistinctSingle(), execTuplesUnequal(), genericPickSplit(), get_distance(), get_partition_for_tuple(), get_position(), get_stats_slot_range(), ginCompareEntries(), gistMakeUnionItVec(), gistMakeUnionKey(), gistUserPicksplit(), has_matching_range(), hash_multirange_extended(), hash_range_extended(), HeapKeyTest(), ineq_histogram_selectivity(), make_greater_string(), mcv_get_match_bitmap(), merge_list_bounds(), merge_overlapping_ranges(), mode_final(), multirange_elem_bsearch_comparison(), OidFunctionCall2Coll(), partition_list_bsearch(), partition_rbound_cmp(), partition_rbound_datum_cmp(), process_ordered_aggregate_single(), qsort_partition_list_value_cmp(), range_cmp_bound_values(), range_cmp_bounds(), range_contains_elem_internal(), range_contains_value(), ri_AttributesEqual(), satisfies_hash_partition(), spgdoinsert(), spgGetCache(), spgInnerTest(), spgLeafTest(), and tuples_equal().

◆ FunctionCall3Coll()

Datum FunctionCall3Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3 
)

Definition at line 1158 of file fmgr.c.

1160 {
1161  LOCAL_FCINFO(fcinfo, 3);
1162  Datum result;
1163 
1164  InitFunctionCallInfoData(*fcinfo, flinfo, 3, collation, NULL, NULL);
1165 
1166  fcinfo->args[0].value = arg1;
1167  fcinfo->args[0].isnull = false;
1168  fcinfo->args[1].value = arg2;
1169  fcinfo->args[1].isnull = false;
1170  fcinfo->args[2].value = arg3;
1171  fcinfo->args[2].isnull = false;
1172 
1173  result = FunctionCallInvoke(fcinfo);
1174 
1175  /* Check for null result, since caller is clearly not expecting one */
1176  if (fcinfo->isnull)
1177  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1178 
1179  return result;
1180 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by bringetbitmap(), ginExtractEntries(), gistKeyIsEQ(), gistpenalty(), OidFunctionCall3Coll(), and union_tuples().

◆ FunctionCall4Coll()

Datum FunctionCall4Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4 
)

Definition at line 1183 of file fmgr.c.

1185 {
1186  LOCAL_FCINFO(fcinfo, 4);
1187  Datum result;
1188 
1189  InitFunctionCallInfoData(*fcinfo, flinfo, 4, collation, NULL, NULL);
1190 
1191  fcinfo->args[0].value = arg1;
1192  fcinfo->args[0].isnull = false;
1193  fcinfo->args[1].value = arg2;
1194  fcinfo->args[1].isnull = false;
1195  fcinfo->args[2].value = arg3;
1196  fcinfo->args[2].isnull = false;
1197  fcinfo->args[3].value = arg4;
1198  fcinfo->args[3].isnull = false;
1199 
1200  result = FunctionCallInvoke(fcinfo);
1201 
1202  /* Check for null result, since caller is clearly not expecting one */
1203  if (fcinfo->isnull)
1204  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1205 
1206  return result;
1207 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by add_values_to_range(), bringetbitmap(), collectMatchBitmap(), matchPartialInPendingList(), OidFunctionCall4Coll(), and scalararraysel().

◆ FunctionCall5Coll()

Datum FunctionCall5Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5 
)

Definition at line 1210 of file fmgr.c.

1212 {
1213  LOCAL_FCINFO(fcinfo, 5);
1214  Datum result;
1215 
1216  InitFunctionCallInfoData(*fcinfo, flinfo, 5, collation, NULL, NULL);
1217 
1218  fcinfo->args[0].value = arg1;
1219  fcinfo->args[0].isnull = false;
1220  fcinfo->args[1].value = arg2;
1221  fcinfo->args[1].isnull = false;
1222  fcinfo->args[2].value = arg3;
1223  fcinfo->args[2].isnull = false;
1224  fcinfo->args[3].value = arg4;
1225  fcinfo->args[3].isnull = false;
1226  fcinfo->args[4].value = arg5;
1227  fcinfo->args[4].isnull = false;
1228 
1229  result = FunctionCallInvoke(fcinfo);
1230 
1231  /* Check for null result, since caller is clearly not expecting one */
1232  if (fcinfo->isnull)
1233  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1234 
1235  return result;
1236 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by gistindex_keytest(), OidFunctionCall5Coll(), scalararraysel(), update_frameheadpos(), and update_frametailpos().

◆ FunctionCall6Coll()

Datum FunctionCall6Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6 
)

Definition at line 1239 of file fmgr.c.

1242 {
1243  LOCAL_FCINFO(fcinfo, 6);
1244  Datum result;
1245 
1246  InitFunctionCallInfoData(*fcinfo, flinfo, 6, collation, NULL, NULL);
1247 
1248  fcinfo->args[0].value = arg1;
1249  fcinfo->args[0].isnull = false;
1250  fcinfo->args[1].value = arg2;
1251  fcinfo->args[1].isnull = false;
1252  fcinfo->args[2].value = arg3;
1253  fcinfo->args[2].isnull = false;
1254  fcinfo->args[3].value = arg4;
1255  fcinfo->args[3].isnull = false;
1256  fcinfo->args[4].value = arg5;
1257  fcinfo->args[4].isnull = false;
1258  fcinfo->args[5].value = arg6;
1259  fcinfo->args[5].isnull = false;
1260 
1261  result = FunctionCallInvoke(fcinfo);
1262 
1263  /* Check for null result, since caller is clearly not expecting one */
1264  if (fcinfo->isnull)
1265  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1266 
1267  return result;
1268 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by OidFunctionCall6Coll().

◆ FunctionCall7Coll()

Datum FunctionCall7Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7 
)

Definition at line 1271 of file fmgr.c.

1274 {
1275  LOCAL_FCINFO(fcinfo, 7);
1276  Datum result;
1277 
1278  InitFunctionCallInfoData(*fcinfo, flinfo, 7, collation, NULL, NULL);
1279 
1280  fcinfo->args[0].value = arg1;
1281  fcinfo->args[0].isnull = false;
1282  fcinfo->args[1].value = arg2;
1283  fcinfo->args[1].isnull = false;
1284  fcinfo->args[2].value = arg3;
1285  fcinfo->args[2].isnull = false;
1286  fcinfo->args[3].value = arg4;
1287  fcinfo->args[3].isnull = false;
1288  fcinfo->args[4].value = arg5;
1289  fcinfo->args[4].isnull = false;
1290  fcinfo->args[5].value = arg6;
1291  fcinfo->args[5].isnull = false;
1292  fcinfo->args[6].value = arg7;
1293  fcinfo->args[6].isnull = false;
1294 
1295  result = FunctionCallInvoke(fcinfo);
1296 
1297  /* Check for null result, since caller is clearly not expecting one */
1298  if (fcinfo->isnull)
1299  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1300 
1301  return result;
1302 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by directTriConsistentFn(), gincost_pattern(), OidFunctionCall7Coll(), and shimBoolConsistentFn().

◆ FunctionCall8Coll()

Datum FunctionCall8Coll ( FmgrInfo flinfo,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7,
Datum  arg8 
)

Definition at line 1305 of file fmgr.c.

1308 {
1309  LOCAL_FCINFO(fcinfo, 8);
1310  Datum result;
1311 
1312  InitFunctionCallInfoData(*fcinfo, flinfo, 8, collation, NULL, NULL);
1313 
1314  fcinfo->args[0].value = arg1;
1315  fcinfo->args[0].isnull = false;
1316  fcinfo->args[1].value = arg2;
1317  fcinfo->args[1].isnull = false;
1318  fcinfo->args[2].value = arg3;
1319  fcinfo->args[2].isnull = false;
1320  fcinfo->args[3].value = arg4;
1321  fcinfo->args[3].isnull = false;
1322  fcinfo->args[4].value = arg5;
1323  fcinfo->args[4].isnull = false;
1324  fcinfo->args[5].value = arg6;
1325  fcinfo->args[5].isnull = false;
1326  fcinfo->args[6].value = arg7;
1327  fcinfo->args[6].isnull = false;
1328  fcinfo->args[7].value = arg8;
1329  fcinfo->args[7].isnull = false;
1330 
1331  result = FunctionCallInvoke(fcinfo);
1332 
1333  /* Check for null result, since caller is clearly not expecting one */
1334  if (fcinfo->isnull)
1335  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1336 
1337  return result;
1338 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by directBoolConsistentFn(), and OidFunctionCall8Coll().

◆ FunctionCall9Coll()

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 at line 1341 of file fmgr.c.

1345 {
1346  LOCAL_FCINFO(fcinfo, 9);
1347  Datum result;
1348 
1349  InitFunctionCallInfoData(*fcinfo, flinfo, 9, collation, NULL, NULL);
1350 
1351  fcinfo->args[0].value = arg1;
1352  fcinfo->args[0].isnull = false;
1353  fcinfo->args[1].value = arg2;
1354  fcinfo->args[1].isnull = false;
1355  fcinfo->args[2].value = arg3;
1356  fcinfo->args[2].isnull = false;
1357  fcinfo->args[3].value = arg4;
1358  fcinfo->args[3].isnull = false;
1359  fcinfo->args[4].value = arg5;
1360  fcinfo->args[4].isnull = false;
1361  fcinfo->args[5].value = arg6;
1362  fcinfo->args[5].isnull = false;
1363  fcinfo->args[6].value = arg7;
1364  fcinfo->args[6].isnull = false;
1365  fcinfo->args[7].value = arg8;
1366  fcinfo->args[7].isnull = false;
1367  fcinfo->args[8].value = arg9;
1368  fcinfo->args[8].isnull = false;
1369 
1370  result = FunctionCallInvoke(fcinfo);
1371 
1372  /* Check for null result, since caller is clearly not expecting one */
1373  if (fcinfo->isnull)
1374  elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1375 
1376  return result;
1377 }

References elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by OidFunctionCall9Coll().

◆ get_call_expr_arg_stable()

bool get_call_expr_arg_stable ( fmNodePtr  expr,
int  argnum 
)

◆ get_call_expr_argtype()

Oid get_call_expr_argtype ( fmNodePtr  expr,
int  argnum 
)

◆ get_fn_expr_arg_stable()

bool get_fn_expr_arg_stable ( FmgrInfo flinfo,
int  argnum 
)

Definition at line 1962 of file fmgr.c.

1963 {
1964  /*
1965  * can't return anything useful if we have no FmgrInfo or if its fn_expr
1966  * node has not been initialized
1967  */
1968  if (!flinfo || !flinfo->fn_expr)
1969  return false;
1970 
1971  return get_call_expr_arg_stable(flinfo->fn_expr, argnum);
1972 }
bool get_call_expr_arg_stable(Node *expr, int argnum)
Definition: fmgr.c:1981
fmNodePtr fn_expr
Definition: fmgr.h:66

References FmgrInfo::fn_expr, and get_call_expr_arg_stable().

Referenced by extract_variadic_args(), leadlag_common(), pg_input_is_valid_common(), and window_nth_value().

◆ get_fn_expr_argtype()

◆ get_fn_expr_rettype()

Oid get_fn_expr_rettype ( FmgrInfo flinfo)

Definition at line 1875 of file fmgr.c.

1876 {
1877  Node *expr;
1878 
1879  /*
1880  * can't return anything useful if we have no FmgrInfo or if its fn_expr
1881  * node has not been initialized
1882  */
1883  if (!flinfo || !flinfo->fn_expr)
1884  return InvalidOid;
1885 
1886  expr = flinfo->fn_expr;
1887 
1888  return exprType(expr);
1889 }
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:43
Definition: nodes.h:129

References exprType(), FmgrInfo::fn_expr, and InvalidOid.

Referenced by do_compile(), multirange_constructor0(), multirange_constructor1(), multirange_constructor2(), range_agg_finalfn(), range_constructor2(), and range_constructor3().

◆ get_fn_expr_variadic()

bool get_fn_expr_variadic ( FmgrInfo flinfo)

Definition at line 2031 of file fmgr.c.

2032 {
2033  Node *expr;
2034 
2035  /*
2036  * can't return anything useful if we have no FmgrInfo or if its fn_expr
2037  * node has not been initialized
2038  */
2039  if (!flinfo || !flinfo->fn_expr)
2040  return false;
2041 
2042  expr = flinfo->fn_expr;
2043 
2044  if (IsA(expr, FuncExpr))
2045  return ((FuncExpr *) expr)->funcvariadic;
2046  else
2047  return false;
2048 }

References FmgrInfo::fn_expr, and IsA.

Referenced by concat_internal(), count_nulls(), extract_variadic_args(), satisfies_hash_partition(), and text_format().

◆ get_fn_opclass_options()

bytea* get_fn_opclass_options ( FmgrInfo flinfo)

Definition at line 2084 of file fmgr.c.

2085 {
2086  if (flinfo && flinfo->fn_expr && IsA(flinfo->fn_expr, Const))
2087  {
2088  Const *expr = (Const *) flinfo->fn_expr;
2089 
2090  if (expr->consttype == BYTEAOID)
2091  return expr->constisnull ? NULL : DatumGetByteaP(expr->constvalue);
2092  }
2093 
2094  ereport(ERROR,
2095  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2096  errmsg("operator class options info is absent in function call context")));
2097 
2098  return NULL;
2099 }
#define DatumGetByteaP(X)
Definition: fmgr.h:331
Oid consttype
Definition: primnodes.h:290

References Const::consttype, DatumGetByteaP, ereport, errcode(), errmsg(), ERROR, FmgrInfo::fn_expr, if(), and IsA.

◆ has_fn_opclass_options()

bool has_fn_opclass_options ( FmgrInfo flinfo)

Definition at line 2068 of file fmgr.c.

2069 {
2070  if (flinfo && flinfo->fn_expr && IsA(flinfo->fn_expr, Const))
2071  {
2072  Const *expr = (Const *) flinfo->fn_expr;
2073 
2074  if (expr->consttype == BYTEAOID)
2075  return !expr->constisnull;
2076  }
2077  return false;
2078 }

References Const::consttype, FmgrInfo::fn_expr, if(), and IsA.

◆ InputFunctionCall()

Datum InputFunctionCall ( FmgrInfo flinfo,
char *  str,
Oid  typioparam,
int32  typmod 
)

Definition at line 1517 of file fmgr.c.

1518 {
1519  LOCAL_FCINFO(fcinfo, 3);
1520  Datum result;
1521 
1522  if (str == NULL && flinfo->fn_strict)
1523  return (Datum) 0; /* just return null result */
1524 
1525  InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, NULL, NULL);
1526 
1527  fcinfo->args[0].value = CStringGetDatum(str);
1528  fcinfo->args[0].isnull = false;
1529  fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1530  fcinfo->args[1].isnull = false;
1531  fcinfo->args[2].value = Int32GetDatum(typmod);
1532  fcinfo->args[2].isnull = false;
1533 
1534  result = FunctionCallInvoke(fcinfo);
1535 
1536  /* Should get null result if and only if str is NULL */
1537  if (str == NULL)
1538  {
1539  if (!fcinfo->isnull)
1540  elog(ERROR, "input function %u returned non-NULL",
1541  flinfo->fn_oid);
1542  }
1543  else
1544  {
1545  if (fcinfo->isnull)
1546  elog(ERROR, "input function %u returned NULL",
1547  flinfo->fn_oid);
1548  }
1549 
1550  return result;
1551 }
bool fn_strict
Definition: fmgr.h:61

References CStringGetDatum(), elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FmgrInfo::fn_strict, FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), and generate_unaccent_rules::str.

Referenced by BuildTupleFromCStrings(), hstore_populate_record(), make_tuple_from_result_row(), NextCopyFrom(), OidInputFunctionCall(), plperl_sv_to_datum(), plsample_func_handler(), pltcl_func_handler(), pltcl_returnnext(), pltcl_SPI_execute_plan(), PLyObject_ToScalar(), PLyUnicode_ToComposite(), populate_scalar(), and XmlTableGetValue().

◆ InputFunctionCallSafe()

bool InputFunctionCallSafe ( FmgrInfo flinfo,
char *  str,
Oid  typioparam,
int32  typmod,
fmNodePtr  escontext,
Datum result 
)

Definition at line 1572 of file fmgr.c.

1576 {
1577  LOCAL_FCINFO(fcinfo, 3);
1578 
1579  if (str == NULL && flinfo->fn_strict)
1580  {
1581  *result = (Datum) 0; /* just return null result */
1582  return true;
1583  }
1584 
1585  InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, escontext, NULL);
1586 
1587  fcinfo->args[0].value = CStringGetDatum(str);
1588  fcinfo->args[0].isnull = false;
1589  fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1590  fcinfo->args[1].isnull = false;
1591  fcinfo->args[2].value = Int32GetDatum(typmod);
1592  fcinfo->args[2].isnull = false;
1593 
1594  *result = FunctionCallInvoke(fcinfo);
1595 
1596  /* Result value is garbage, and could be null, if an error was reported */
1597  if (SOFT_ERROR_OCCURRED(escontext))
1598  return false;
1599 
1600  /* Otherwise, should get null result if and only if str is NULL */
1601  if (str == NULL)
1602  {
1603  if (!fcinfo->isnull)
1604  elog(ERROR, "input function %u returned non-NULL",
1605  flinfo->fn_oid);
1606  }
1607  else
1608  {
1609  if (fcinfo->isnull)
1610  elog(ERROR, "input function %u returned NULL",
1611  flinfo->fn_oid);
1612  }
1613 
1614  return true;
1615 }

References CStringGetDatum(), elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FmgrInfo::fn_strict, FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), SOFT_ERROR_OCCURRED, and generate_unaccent_rules::str.

Referenced by domain_in(), multirange_in(), pg_input_is_valid_common(), range_in(), ReadArrayStr(), and record_in().

◆ load_external_function()

void* load_external_function ( const char *  filename,
const char *  funcname,
bool  signalNotFound,
void **  filehandle 
)

Definition at line 105 of file dfmgr.c.

107 {
108  char *fullname;
109  void *lib_handle;
110  void *retval;
111 
112  /* Expand the possibly-abbreviated filename to an exact path name */
114 
115  /* Load the shared library, unless we already did */
116  lib_handle = internal_load_library(fullname);
117 
118  /* Return handle if caller wants it */
119  if (filehandle)
120  *filehandle = lib_handle;
121 
122  /* Look up the function within the library. */
123  retval = dlsym(lib_handle, funcname);
124 
125  if (retval == NULL && signalNotFound)
126  ereport(ERROR,
127  (errcode(ERRCODE_UNDEFINED_FUNCTION),
128  errmsg("could not find function \"%s\" in file \"%s\"",
129  funcname, fullname)));
130 
131  pfree(fullname);
132  return retval;
133 }
static char * expand_dynamic_library_name(const char *name)
Definition: dfmgr.c:431
static void * internal_load_library(const char *libname)
Definition: dfmgr.c:184
static char * filename
Definition: pg_dumpall.c:119
void * dlsym(void *handle, const char *symbol)
Definition: win32dlopen.c:61

References dlsym(), ereport, errcode(), errmsg(), ERROR, expand_dynamic_library_name(), filename, funcname, internal_load_library(), and pfree().

Referenced by _PG_init(), fmgr_c_validator(), fmgr_info_C_lang(), llvm_resolve_symbol(), LoadArchiveLibrary(), LoadOutputPlugin(), LookupBackgroundWorkerFunction(), LookupParallelWorkerFunction(), and provider_init().

◆ load_file()

void load_file ( const char *  filename,
bool  restricted 
)

Definition at line 144 of file dfmgr.c.

145 {
146  char *fullname;
147 
148  /* Apply security restriction if requested */
149  if (restricted)
151 
152  /* Expand the possibly-abbreviated filename to an exact path name */
154 
155  /* Load the shared library */
156  (void) internal_load_library(fullname);
157 
158  pfree(fullname);
159 }
static void check_restricted_library_name(const char *name)
Definition: dfmgr.c:486

References check_restricted_library_name(), expand_dynamic_library_name(), filename, internal_load_library(), and pfree().

Referenced by AlterSubscription(), AlterSubscription_refresh(), ApplyWorkerMain(), CreateSubscription(), DropSubscription(), load_libraries(), ReplicationSlotDropAtPubNode(), standard_ProcessUtility(), and WalReceiverMain().

◆ lookup_external_function()

void* lookup_external_function ( void *  filehandle,
const char *  funcname 
)

Definition at line 166 of file dfmgr.c.

167 {
168  return dlsym(filehandle, funcname);
169 }

References dlsym(), and funcname.

Referenced by fetch_finfo_record().

◆ OidFunctionCall0Coll()

Datum OidFunctionCall0Coll ( Oid  functionId,
Oid  collation 
)

Definition at line 1388 of file fmgr.c.

1389 {
1390  FmgrInfo flinfo;
1391 
1392  fmgr_info(functionId, &flinfo);
1393 
1394  return FunctionCall0Coll(&flinfo, collation);
1395 }
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition: fmgr.c:127
Datum FunctionCall0Coll(FmgrInfo *flinfo, Oid collation)
Definition: fmgr.c:1099

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall0Coll().

◆ OidFunctionCall1Coll()

Datum OidFunctionCall1Coll ( Oid  functionId,
Oid  collation,
Datum  arg1 
)

Definition at line 1398 of file fmgr.c.

1399 {
1400  FmgrInfo flinfo;
1401 
1402  fmgr_info(functionId, &flinfo);
1403 
1404  return FunctionCall1Coll(&flinfo, collation, arg1);
1405 }
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
Definition: fmgr.c:1116

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall1Coll().

Referenced by _bt_allequalimage(), and _hash_datum2hashkey_type().

◆ OidFunctionCall2Coll()

Datum OidFunctionCall2Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2 
)

Definition at line 1408 of file fmgr.c.

1409 {
1410  FmgrInfo flinfo;
1411 
1412  fmgr_info(functionId, &flinfo);
1413 
1414  return FunctionCall2Coll(&flinfo, collation, arg1, arg2);
1415 }
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:1136

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall2Coll().

Referenced by _bt_compare_scankey_args(), and index_recheck_constraint().

◆ OidFunctionCall3Coll()

Datum OidFunctionCall3Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3 
)

Definition at line 1418 of file fmgr.c.

1420 {
1421  FmgrInfo flinfo;
1422 
1423  fmgr_info(functionId, &flinfo);
1424 
1425  return FunctionCall3Coll(&flinfo, collation, arg1, arg2, arg3);
1426 }
Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Definition: fmgr.c:1158

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall3Coll().

◆ OidFunctionCall4Coll()

Datum OidFunctionCall4Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4 
)

Definition at line 1429 of file fmgr.c.

1431 {
1432  FmgrInfo flinfo;
1433 
1434  fmgr_info(functionId, &flinfo);
1435 
1436  return FunctionCall4Coll(&flinfo, collation, arg1, arg2, arg3, arg4);
1437 }
Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
Definition: fmgr.c:1183

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall4Coll().

Referenced by restriction_selectivity().

◆ OidFunctionCall5Coll()

Datum OidFunctionCall5Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5 
)

Definition at line 1440 of file fmgr.c.

1442 {
1443  FmgrInfo flinfo;
1444 
1445  fmgr_info(functionId, &flinfo);
1446 
1447  return FunctionCall5Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5);
1448 }
Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
Definition: fmgr.c:1210

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall5Coll().

Referenced by join_selectivity().

◆ OidFunctionCall6Coll()

Datum OidFunctionCall6Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6 
)

Definition at line 1451 of file fmgr.c.

1454 {
1455  FmgrInfo flinfo;
1456 
1457  fmgr_info(functionId, &flinfo);
1458 
1459  return FunctionCall6Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1460  arg6);
1461 }
Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
Definition: fmgr.c:1239

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall6Coll().

◆ OidFunctionCall7Coll()

Datum OidFunctionCall7Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7 
)

Definition at line 1464 of file fmgr.c.

1467 {
1468  FmgrInfo flinfo;
1469 
1470  fmgr_info(functionId, &flinfo);
1471 
1472  return FunctionCall7Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1473  arg6, arg7);
1474 }
Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
Definition: fmgr.c:1271

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall7Coll().

◆ OidFunctionCall8Coll()

Datum OidFunctionCall8Coll ( Oid  functionId,
Oid  collation,
Datum  arg1,
Datum  arg2,
Datum  arg3,
Datum  arg4,
Datum  arg5,
Datum  arg6,
Datum  arg7,
Datum  arg8 
)

Definition at line 1477 of file fmgr.c.

1480 {
1481  FmgrInfo flinfo;
1482 
1483  fmgr_info(functionId, &flinfo);
1484 
1485  return FunctionCall8Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1486  arg6, arg7, arg8);
1487 }
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:1305

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall8Coll().

◆ OidFunctionCall9Coll()

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 at line 1490 of file fmgr.c.

1494 {
1495  FmgrInfo flinfo;
1496 
1497  fmgr_info(functionId, &flinfo);
1498 
1499  return FunctionCall9Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1500  arg6, arg7, arg8, arg9);
1501 }
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:1341

References fmgr_security_definer_cache::flinfo, fmgr_info(), and FunctionCall9Coll().

◆ OidInputFunctionCall()

Datum OidInputFunctionCall ( Oid  functionId,
char *  str,
Oid  typioparam,
int32  typmod 
)

Definition at line 1741 of file fmgr.c.

1742 {
1743  FmgrInfo flinfo;
1744 
1745  fmgr_info(functionId, &flinfo);
1746  return InputFunctionCall(&flinfo, str, typioparam, typmod);
1747 }
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
Definition: fmgr.c:1517

References fmgr_security_definer_cache::flinfo, fmgr_info(), InputFunctionCall(), and generate_unaccent_rules::str.

Referenced by DefineAggregate(), exec_bind_message(), get_typdefault(), GetAggInitVal(), InsertOneValue(), parse_fcall_arguments(), slot_modify_data(), slot_store_data(), and stringTypeDatum().

◆ OidOutputFunctionCall()

◆ OidReceiveFunctionCall()

Datum OidReceiveFunctionCall ( Oid  functionId,
fmStringInfo  buf,
Oid  typioparam,
int32  typmod 
)

Definition at line 1759 of file fmgr.c.

1761 {
1762  FmgrInfo flinfo;
1763 
1764  fmgr_info(functionId, &flinfo);
1765  return ReceiveFunctionCall(&flinfo, buf, typioparam, typmod);
1766 }
Datum ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf, Oid typioparam, int32 typmod)
Definition: fmgr.c:1684
static char * buf
Definition: pg_test_fsync.c:67

References buf, fmgr_security_definer_cache::flinfo, fmgr_info(), and ReceiveFunctionCall().

Referenced by exec_bind_message(), parse_fcall_arguments(), slot_modify_data(), and slot_store_data().

◆ OidSendFunctionCall()

bytea* OidSendFunctionCall ( Oid  functionId,
Datum  val 
)

Definition at line 1769 of file fmgr.c.

1770 {
1771  FmgrInfo flinfo;
1772 
1773  fmgr_info(functionId, &flinfo);
1774  return SendFunctionCall(&flinfo, val);
1775 }
bytea * SendFunctionCall(FmgrInfo *flinfo, Datum val)
Definition: fmgr.c:1731

References fmgr_security_definer_cache::flinfo, fmgr_info(), SendFunctionCall(), and val.

Referenced by logicalrep_write_tuple(), and SendFunctionResult().

◆ OutputFunctionCall()

◆ pg_detoast_datum()

struct varlena* pg_detoast_datum ( struct varlena datum)

Definition at line 1819 of file fmgr.c.

1820 {
1821  if (VARATT_IS_EXTENDED(datum))
1822  return detoast_attr(datum);
1823  else
1824  return datum;
1825 }
struct varlena * detoast_attr(struct varlena *attr)
Definition: detoast.c:116
#define VARATT_IS_EXTENDED(PTR)
Definition: varatt.h:303

References detoast_attr(), and VARATT_IS_EXTENDED.

◆ pg_detoast_datum_copy()

struct varlena* pg_detoast_datum_copy ( struct varlena datum)

Definition at line 1828 of file fmgr.c.

1829 {
1830  if (VARATT_IS_EXTENDED(datum))
1831  return detoast_attr(datum);
1832  else
1833  {
1834  /* Make a modifiable copy of the varlena object */
1835  Size len = VARSIZE(datum);
1836  struct varlena *result = (struct varlena *) palloc(len);
1837 
1838  memcpy(result, datum, len);
1839  return result;
1840  }
1841 }
void * palloc(Size size)
Definition: mcxt.c:1210
const void size_t len
#define VARSIZE(PTR)
Definition: varatt.h:279

References detoast_attr(), len, palloc(), VARATT_IS_EXTENDED, and VARSIZE.

Referenced by tuple_data_split_internal().

◆ pg_detoast_datum_packed()

struct varlena* pg_detoast_datum_packed ( struct varlena datum)

Definition at line 1851 of file fmgr.c.

1852 {
1853  if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
1854  return detoast_attr(datum);
1855  else
1856  return datum;
1857 }
#define VARATT_IS_COMPRESSED(PTR)
Definition: varatt.h:288
#define VARATT_IS_EXTERNAL(PTR)
Definition: varatt.h:289

References detoast_attr(), VARATT_IS_COMPRESSED, and VARATT_IS_EXTERNAL.

Referenced by makeJsonLexContext(), text_to_cstring(), text_to_cstring_buffer(), and transform_jsonb_string_values().

◆ pg_detoast_datum_slice()

struct varlena* pg_detoast_datum_slice ( struct varlena datum,
int32  first,
int32  count 
)

Definition at line 1844 of file fmgr.c.

1845 {
1846  /* Only get the specified portion from the toast rel */
1847  return detoast_attr_slice(datum, first, count);
1848 }
struct varlena * detoast_attr_slice(struct varlena *attr, int32 sliceoffset, int32 slicelength)
Definition: detoast.c:205

References detoast_attr_slice().

◆ ReceiveFunctionCall()

Datum ReceiveFunctionCall ( FmgrInfo flinfo,
fmStringInfo  buf,
Oid  typioparam,
int32  typmod 
)

Definition at line 1684 of file fmgr.c.

1686 {
1687  LOCAL_FCINFO(fcinfo, 3);
1688  Datum result;
1689 
1690  if (buf == NULL && flinfo->fn_strict)
1691  return (Datum) 0; /* just return null result */
1692 
1693  InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, NULL, NULL);
1694 
1695  fcinfo->args[0].value = PointerGetDatum(buf);
1696  fcinfo->args[0].isnull = false;
1697  fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1698  fcinfo->args[1].isnull = false;
1699  fcinfo->args[2].value = Int32GetDatum(typmod);
1700  fcinfo->args[2].isnull = false;
1701 
1702  result = FunctionCallInvoke(fcinfo);
1703 
1704  /* Should get null result if and only if buf is NULL */
1705  if (buf == NULL)
1706  {
1707  if (!fcinfo->isnull)
1708  elog(ERROR, "receive function %u returned non-NULL",
1709  flinfo->fn_oid);
1710  }
1711  else
1712  {
1713  if (fcinfo->isnull)
1714  elog(ERROR, "receive function %u returned NULL",
1715  flinfo->fn_oid);
1716  }
1717 
1718  return result;
1719 }
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322

References buf, elog(), ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FmgrInfo::fn_strict, FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), and PointerGetDatum().

Referenced by array_agg_deserialize(), CopyReadBinaryAttribute(), domain_recv(), multirange_recv(), OidReceiveFunctionCall(), range_recv(), ReadArrayBinary(), and record_recv().

◆ RestoreLibraryState()

void RestoreLibraryState ( char *  start_address)

Definition at line 693 of file dfmgr.c.

694 {
695  while (*start_address != '\0')
696  {
697  internal_load_library(start_address);
698  start_address += strlen(start_address) + 1;
699  }
700 }

References internal_load_library().

Referenced by ParallelWorkerMain().

◆ SendFunctionCall()

bytea* SendFunctionCall ( FmgrInfo flinfo,
Datum  val 
)

◆ SerializeLibraryState()

void SerializeLibraryState ( Size  maxsize,
char *  start_address 
)

Definition at line 671 of file dfmgr.c.

672 {
673  DynamicFileList *file_scanner;
674 
675  for (file_scanner = file_list;
676  file_scanner != NULL;
677  file_scanner = file_scanner->next)
678  {
679  Size len;
680 
681  len = strlcpy(start_address, file_scanner->filename, maxsize) + 1;
682  Assert(len < maxsize);
683  maxsize -= len;
684  start_address += len;
685  }
686  start_address[0] = '\0';
687 }
Assert(fmt[strlen(fmt) - 1] !='\n')
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45

References Assert(), file_list, df_files::filename, len, df_files::next, and strlcpy().

Referenced by InitializeParallelDSM().

◆ set_fn_opclass_options()

void set_fn_opclass_options ( FmgrInfo flinfo,
bytea options 
)

Definition at line 2057 of file fmgr.c.

2058 {
2059  flinfo->fn_expr = (Node *) makeConst(BYTEAOID, -1, InvalidOid, -1,
2061  options == NULL, false);
2062 }
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Definition: makefuncs.c:301

References FmgrInfo::fn_expr, InvalidOid, makeConst(), and PointerGetDatum().

Referenced by gincost_pattern(), and index_getprocinfo().

◆ StaticAssertDecl()

StaticAssertDecl ( sizeof(FMGR_ABI_EXTRA)<=sizeof(((Pg_magic_struct *) 0) ->abi_extra)  ,
"FMGR_ABI_EXTRA too long"   
)

Variable Documentation

◆ Dynamic_library_path

PGDLLIMPORT char* Dynamic_library_path
extern

Definition at line 76 of file dfmgr.c.

Referenced by find_in_dynamic_libpath().

◆ fmgr_hook

PGDLLIMPORT fmgr_hook_type fmgr_hook
extern

Definition at line 40 of file fmgr.c.

Referenced by fmgr_security_definer(), and sepgsql_init_client_label().

◆ needs_fmgr_hook

PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook
extern

Definition at line 39 of file fmgr.c.

Referenced by sepgsql_init_client_label().