PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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_abi_values
 
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((varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_COPY(datum)    pg_detoast_datum_copy((varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_SLICE(datum, f, c)
 
#define PG_DETOAST_DATUM_PACKED(datum)    pg_detoast_datum_packed((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_OID8(n)   DatumGetObjectId8(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)   ((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_OID8(x)   return ObjectId8GetDatum(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_ABI_DATA
 
#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 PG_MODULE_MAGIC_EXT(...)
 
#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 Node Node
 
typedef struct Aggref Aggref
 
typedef void(* ExprContextCallbackFunction) (Datum arg)
 
typedef struct StringInfoDataStringInfo
 
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 struct DynamicFileList DynamicFileList
 
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)
 
varlenapg_detoast_datum (varlena *datum)
 
varlenapg_detoast_datum_copy (varlena *datum)
 
varlenapg_detoast_datum_slice (varlena *datum, int32 first, int32 count)
 
varlenapg_detoast_datum_packed (varlena *datum)
 
PGDLLEXPORT void _PG_init (void)
 
 StaticAssertDecl (sizeof(FMGR_ABI_EXTRA)<=sizeof(((Pg_abi_values *) 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, Node *escontext, Datum *result)
 
bool DirectInputFunctionCallSafe (PGFunction func, char *str, Oid typioparam, int32 typmod, Node *escontext, Datum *result)
 
Datum OidInputFunctionCall (Oid functionId, char *str, Oid typioparam, int32 typmod)
 
charOutputFunctionCall (FmgrInfo *flinfo, Datum val)
 
charOidOutputFunctionCall (Oid functionId, Datum val)
 
Datum ReceiveFunctionCall (FmgrInfo *flinfo, StringInfo buf, Oid typioparam, int32 typmod)
 
Datum OidReceiveFunctionCall (Oid functionId, StringInfo 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 (Node *expr, int argnum)
 
bool get_fn_expr_arg_stable (FmgrInfo *flinfo, int argnum)
 
bool get_call_expr_arg_stable (Node *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)
 
charsubstitute_path_macro (const char *str, const char *macro, const char *value)
 
charfind_in_path (const char *basename, const char *path, const char *path_param, const char *macro, const char *macro_val)
 
voidload_external_function (const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
 
voidlookup_external_function (void *filehandle, const char *funcname)
 
void load_file (const char *filename, bool restricted)
 
DynamicFileListget_first_loaded_module (void)
 
DynamicFileListget_next_loaded_module (DynamicFileList *dfptr)
 
void get_loaded_module_details (DynamicFileList *dfptr, const char **library_path, const char **module_name, const char **module_version)
 
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)
 
AggrefAggGetAggref (FunctionCallInfo fcinfo)
 
MemoryContext AggGetTempMemoryContext (FunctionCallInfo fcinfo)
 
bool AggStateIsShared (FunctionCallInfo fcinfo)
 
void AggRegisterCallback (FunctionCallInfo fcinfo, ExprContextCallbackFunction func, Datum arg)
 

Variables

PGDLLIMPORT charDynamic_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 814 of file fmgr.h.

◆ AGG_CONTEXT_WINDOW

#define AGG_CONTEXT_WINDOW   2 /* window function */

Definition at line 815 of file fmgr.h.

◆ DatumGetBpCharP

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

Definition at line 334 of file fmgr.h.

◆ DatumGetBpCharPCopy

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

Definition at line 300 of file fmgr.h.

◆ DatumGetBpCharPP

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

Definition at line 294 of file fmgr.h.

◆ DatumGetBpCharPSlice

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

Definition at line 306 of file fmgr.h.

◆ DatumGetByteaP

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

Definition at line 332 of file fmgr.h.

◆ DatumGetByteaPCopy

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

Definition at line 298 of file fmgr.h.

◆ DatumGetByteaPP

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

Definition at line 292 of file fmgr.h.

◆ DatumGetByteaPSlice

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

Definition at line 304 of file fmgr.h.

◆ DatumGetHeapTupleHeader

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

Definition at line 296 of file fmgr.h.

◆ DatumGetHeapTupleHeaderCopy

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

Definition at line 302 of file fmgr.h.

◆ DatumGetTextP

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

Definition at line 333 of file fmgr.h.

◆ DatumGetTextPCopy

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

Definition at line 299 of file fmgr.h.

◆ DatumGetTextPP

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

Definition at line 293 of file fmgr.h.

◆ DatumGetTextPSlice

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

Definition at line 305 of file fmgr.h.

◆ DatumGetVarCharP

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

Definition at line 335 of file fmgr.h.

◆ DatumGetVarCharPCopy

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

Definition at line 301 of file fmgr.h.

◆ DatumGetVarCharPP

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

Definition at line 295 of file fmgr.h.

◆ DatumGetVarCharPSlice

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

Definition at line 307 of file fmgr.h.

◆ DirectFunctionCall1

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

Definition at line 684 of file fmgr.h.

836{
838 FHET_END,
841
842typedef bool (*needs_fmgr_hook_type) (Oid fn_oid);
843
844typedef void (*fmgr_hook_type) (FmgrHookEventType event,
845 FmgrInfo *flinfo, Datum *arg);
846
849
850#define FmgrHookIsNeeded(fn_oid) \
851 (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid))
852
853#endif /* FMGR_H */
#define PGDLLIMPORT
Definition c.h:1421
Datum arg
Definition elog.c:1322
bool(* needs_fmgr_hook_type)(Oid fn_oid)
Definition fmgr.h:842
PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook
Definition fmgr.c:41
FmgrHookEventType
Definition fmgr.h:836
@ FHET_END
Definition fmgr.h:838
@ FHET_ABORT
Definition fmgr.h:839
@ FHET_START
Definition fmgr.h:837
PGDLLIMPORT fmgr_hook_type fmgr_hook
Definition fmgr.c:42
void(* fmgr_hook_type)(FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg)
Definition fmgr.h:844
uint64_t Datum
Definition postgres.h:70
unsigned int Oid
static int fb(int x)

◆ DirectFunctionCall2

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

Definition at line 686 of file fmgr.h.

◆ DirectFunctionCall3

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

Definition at line 688 of file fmgr.h.

◆ DirectFunctionCall4

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

Definition at line 690 of file fmgr.h.

◆ DirectFunctionCall5

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

Definition at line 692 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 694 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 696 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 698 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 700 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 850 of file fmgr.h.

851 : (*needs_fmgr_hook)(fn_oid))

◆ FunctionCall1

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

Definition at line 702 of file fmgr.h.

◆ FunctionCall2

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

Definition at line 704 of file fmgr.h.

◆ FunctionCall3

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

Definition at line 706 of file fmgr.h.

◆ FunctionCall4

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

Definition at line 708 of file fmgr.h.

◆ FunctionCall5

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

Definition at line 710 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 712 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 714 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 716 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 718 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.

151 { \
152 (Fcinfo).flinfo = (Flinfo); \
153 (Fcinfo).context = (Context); \
154 (Fcinfo).resultinfo = (Resultinfo); \
155 (Fcinfo).fncollation = (Collation); \
156 (Fcinfo).isnull = false; \
157 (Fcinfo).nargs = (Nargs); \
158 } while (0)

◆ LOCAL_FCINFO

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

Definition at line 110 of file fmgr.h.

113 { \
115 /* ensure enough space for nargs args is available */ \
116 char fcinfo_data[SizeForFunctionCallInfo(nargs)]; \
117 } name##data; \
118 FunctionCallInfo name = &name##data.fcinfo

◆ OidFunctionCall0

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

Definition at line 720 of file fmgr.h.

◆ OidFunctionCall1

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

Definition at line 722 of file fmgr.h.

◆ OidFunctionCall2

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

Definition at line 724 of file fmgr.h.

◆ OidFunctionCall3

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

Definition at line 726 of file fmgr.h.

◆ OidFunctionCall4

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

Definition at line 728 of file fmgr.h.

◆ OidFunctionCall5

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

Definition at line 730 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 732 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 734 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 736 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 738 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((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((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((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))
int32_t int32
Definition c.h:620
varlena * pg_detoast_datum_slice(varlena *datum, int32 first, int32 count)
Definition fmgr.c:1823
static Pointer DatumGetPointer(Datum X)
Definition postgres.h:332
char * c
Definition c.h:776

Definition at line 244 of file fmgr.h.

◆ PG_FREE_IF_COPY

#define PG_FREE_IF_COPY (   ptr,
 
)
Value:
do { \
if ((ptr) != PG_GETARG_POINTER(n)) \
pfree(ptr); \
} while (0)
#define PG_GETARG_POINTER(n)
Definition fmgr.h:277

Definition at line 260 of file fmgr.h.

261 { \
262 if ((ptr) != PG_GETARG_POINTER(n)) \
263 pfree(ptr); \
264 } while (0)

◆ 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:
{ \
static const Pg_finfo_record my_finfo = { 1 }; \
return &my_finfo; \
} \
extern int no_such_variable
#define CppConcat(x, y)
Definition c.h:507
#define PGDLLEXPORT
Definition c.h:1436
#define PG_FUNCTION_ARGS
Definition fmgr.h:193
#define funcname

Definition at line 417 of file fmgr.h.

422{ \
423 static const Pg_finfo_record my_finfo = { 1 }; \
424 return &my_finfo; \
425} \
426extern int no_such_variable

◆ 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 343 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 338 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P_COPY

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

Definition at line 317 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 323 of file fmgr.h.

◆ PG_GETARG_BPCHAR_PP

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

Definition at line 311 of file fmgr.h.

◆ PG_GETARG_BYTEA_P

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

Definition at line 336 of file fmgr.h.

◆ PG_GETARG_BYTEA_P_COPY

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

Definition at line 315 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 321 of file fmgr.h.

◆ PG_GETARG_BYTEA_PP

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

Definition at line 309 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 278 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 282 of file fmgr.h.

◆ PG_GETARG_FLOAT8

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

Definition at line 283 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER

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

Definition at line 313 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER_COPY

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

Definition at line 319 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 284 of file fmgr.h.

◆ PG_GETARG_NAME

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

Definition at line 279 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_OID8

#define PG_GETARG_OID8 (   n)    DatumGetObjectId8(PG_GETARG_DATUM(n))

Definition at line 276 of file fmgr.h.

◆ PG_GETARG_POINTER

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

Definition at line 277 of file fmgr.h.

◆ PG_GETARG_RAW_VARLENA_P

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

Definition at line 286 of file fmgr.h.

◆ PG_GETARG_TEXT_P

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

Definition at line 337 of file fmgr.h.

◆ PG_GETARG_TEXT_P_COPY

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

Definition at line 316 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 322 of file fmgr.h.

◆ PG_GETARG_TEXT_PP

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

Definition at line 310 of file fmgr.h.

◆ PG_GETARG_TRANSACTIONID

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

Definition at line 280 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 339 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P_COPY

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

Definition at line 318 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 324 of file fmgr.h.

◆ PG_GETARG_VARCHAR_PP

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

Definition at line 312 of file fmgr.h.

◆ PG_GETARG_VARLENA_P

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

Definition at line 288 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 290 of file fmgr.h.

◆ PG_HAS_OPCLASS_OPTIONS

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

Definition at line 342 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME

#define PG_MAGIC_FUNCTION_NAME   Pg_magic_func

Definition at line 519 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME_STRING

#define PG_MAGIC_FUNCTION_NAME_STRING   "Pg_magic_func"

Definition at line 520 of file fmgr.h.

◆ PG_MODULE_ABI_DATA

#define PG_MODULE_ABI_DATA
Value:
{ \
PG_VERSION_NUM / 100, \
}
#define FLOAT8PASSBYVAL
Definition c.h:720
#define INDEX_MAX_KEYS
#define NAMEDATALEN
#define FMGR_ABI_EXTRA
#define FUNC_MAX_ARGS

Definition at line 489 of file fmgr.h.

490{ \
491 PG_VERSION_NUM / 100, \
494 NAMEDATALEN, \
497}

◆ PG_MODULE_MAGIC

#define PG_MODULE_MAGIC
Value:
{ \
return &Pg_magic_data; \
} \
extern int no_such_variable
#define PG_MAGIC_FUNCTION_NAME
Definition fmgr.h:519
#define PG_MODULE_MAGIC_DATA(...)
Definition fmgr.h:503

Definition at line 522 of file fmgr.h.

526{ \
528 return &Pg_magic_data; \
529} \
530extern int no_such_variable

◆ PG_MODULE_MAGIC_DATA

#define PG_MODULE_MAGIC_DATA (   ...)
Value:
{ \
.len = sizeof(Pg_magic_struct), \
.abi_fields = PG_MODULE_ABI_DATA, \
}
#define PG_MODULE_ABI_DATA
Definition fmgr.h:489

Definition at line 503 of file fmgr.h.

504{ \
505 .len = sizeof(Pg_magic_struct), \
506 .abi_fields = PG_MODULE_ABI_DATA, \
508}

◆ PG_MODULE_MAGIC_EXT

#define PG_MODULE_MAGIC_EXT (   ...)
Value:

Definition at line 540 of file fmgr.h.

544{ \
545 static const Pg_magic_struct Pg_magic_data = \
547 return &Pg_magic_data; \
548} \
549extern int no_such_variable

◆ 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 360 of file fmgr.h.

◆ PG_RETURN_BPCHAR_P

#define PG_RETURN_BPCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 375 of file fmgr.h.

◆ PG_RETURN_BYTEA_P

#define PG_RETURN_BYTEA_P (   x)    PG_RETURN_POINTER(x)

Definition at line 373 of file fmgr.h.

◆ PG_RETURN_CHAR

#define PG_RETURN_CHAR (   x)    return CharGetDatum(x)

Definition at line 359 of file fmgr.h.

◆ PG_RETURN_CSTRING

#define PG_RETURN_CSTRING (   x)    return CStringGetDatum(x)

Definition at line 364 of file fmgr.h.

◆ PG_RETURN_DATUM

#define PG_RETURN_DATUM (   x)    return (x)

Definition at line 354 of file fmgr.h.

◆ PG_RETURN_FLOAT4

#define PG_RETURN_FLOAT4 (   x)    return Float4GetDatum(x)

Definition at line 368 of file fmgr.h.

◆ PG_RETURN_FLOAT8

#define PG_RETURN_FLOAT8 (   x)    return Float8GetDatum(x)

Definition at line 369 of file fmgr.h.

◆ PG_RETURN_HEAPTUPLEHEADER

#define PG_RETURN_HEAPTUPLEHEADER (   x)    return HeapTupleHeaderGetDatum(x)

Definition at line 377 of file fmgr.h.

◆ PG_RETURN_INT16

#define PG_RETURN_INT16 (   x)    return Int16GetDatum(x)

Definition at line 357 of file fmgr.h.

◆ PG_RETURN_INT32

#define PG_RETURN_INT32 (   x)    return Int32GetDatum(x)

Definition at line 355 of file fmgr.h.

◆ PG_RETURN_INT64

#define PG_RETURN_INT64 (   x)    return Int64GetDatum(x)

Definition at line 370 of file fmgr.h.

◆ PG_RETURN_NAME

#define PG_RETURN_NAME (   x)    return NameGetDatum(x)

Definition at line 365 of file fmgr.h.

◆ PG_RETURN_NULL

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

Definition at line 346 of file fmgr.h.

347 { fcinfo->isnull = true; return (Datum) 0; } while (0)

◆ PG_RETURN_OID

#define PG_RETURN_OID (   x)    return ObjectIdGetDatum(x)

Definition at line 361 of file fmgr.h.

◆ PG_RETURN_OID8

#define PG_RETURN_OID8 (   x)    return ObjectId8GetDatum(x)

Definition at line 362 of file fmgr.h.

◆ PG_RETURN_POINTER

#define PG_RETURN_POINTER (   x)    return PointerGetDatum(x)

Definition at line 363 of file fmgr.h.

◆ PG_RETURN_TEXT_P

#define PG_RETURN_TEXT_P (   x)    PG_RETURN_POINTER(x)

Definition at line 374 of file fmgr.h.

◆ PG_RETURN_TRANSACTIONID

#define PG_RETURN_TRANSACTIONID (   x)    return TransactionIdGetDatum(x)

Definition at line 366 of file fmgr.h.

◆ PG_RETURN_UINT16

#define PG_RETURN_UINT16 (   x)    return UInt16GetDatum(x)

Definition at line 358 of file fmgr.h.

◆ PG_RETURN_UINT32

#define PG_RETURN_UINT32 (   x)    return UInt32GetDatum(x)

Definition at line 356 of file fmgr.h.

◆ PG_RETURN_UINT64

#define PG_RETURN_UINT64 (   x)    return UInt64GetDatum(x)

Definition at line 371 of file fmgr.h.

◆ PG_RETURN_VARCHAR_P

#define PG_RETURN_VARCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 376 of file fmgr.h.

◆ PG_RETURN_VOID

#define PG_RETURN_VOID ( )    return (Datum) 0

Definition at line 350 of file fmgr.h.

◆ SizeForFunctionCallInfo

#define SizeForFunctionCallInfo (   nargs)
Value:

Definition at line 102 of file fmgr.h.

Typedef Documentation

◆ Aggref

Definition at line 23 of file fmgr.h.

◆ DynamicFileList

Definition at line 784 of file fmgr.h.

◆ ExprContextCallbackFunction

typedef void(* ExprContextCallbackFunction) (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 844 of file fmgr.h.

◆ FmgrHookEventType

◆ FmgrInfo

◆ 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 842 of file fmgr.h.

◆ Node

typedef struct Node Node

Definition at line 22 of file fmgr.h.

◆ PGFInfoFunction

typedef const Pg_finfo_record *(* PGFInfoFunction) (void)

Definition at line 403 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 517 of file fmgr.h.

◆ StringInfo

Definition at line 29 of file fmgr.h.

Enumeration Type Documentation

◆ FmgrHookEventType

Enumerator
FHET_START 
FHET_END 
FHET_ABORT 

Definition at line 835 of file fmgr.h.

836{
838 FHET_END,

Function Documentation

◆ _PG_init()

PGDLLEXPORT void _PG_init ( void  )
extern

Definition at line 55 of file auth_delay.c.

56{
57 /* Define custom GUC variables */
58 DefineCustomIntVariable("auth_delay.milliseconds",
59 "Milliseconds to delay before reporting authentication failure",
60 NULL,
62 0,
63 0, INT_MAX / 1000,
66 NULL,
67 NULL,
68 NULL);
69
70 MarkGUCPrefixReserved("auth_delay");
71
72 /* Install Hooks */
75}
ClientAuthentication_hook_type ClientAuthentication_hook
Definition auth.c:224
static void auth_delay_checks(Port *port, int status)
Definition auth_delay.c:34
static int auth_delay_milliseconds
Definition auth_delay.c:25
static ClientAuthentication_hook_type original_client_auth_hook
Definition auth_delay.c:28
void MarkGUCPrefixReserved(const char *className)
Definition guc.c:5180
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:5067
#define GUC_UNIT_MS
Definition guc.h:239
@ PGC_SIGHUP
Definition guc.h:75

References AccessExclusiveLock, add_int_reloption(), add_reloption_kind(), apw_start_leader_worker(), archive_directory, auth_delay_checks(), auth_delay_milliseconds, authn_id, authorize_tokens, 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, BaseBackupAddTarget(), BC_ON, 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, builtin_crypto_enabled, builtin_crypto_options, check_archive_directory(), check_password(), check_password_hook, ClientAuthentication_hook, create_reloptions_table(), custom_stats, custom_stats, DEFAULT_BLOOM_BITS, DEFAULT_BLOOM_LENGTH, DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), delay_execution_planner(), dummy_object_relabel(), EAN13_index, EAN13_range, elog, EnableQueryId(), ereport, errcode(), errdetail(), errmsg, ERROR, error_detail, es_extension_id, es_extension_id, ExecutorCheckPerms_hook, ExecutorEnd_hook, ExecutorFinish_hook, ExecutorRun_hook, ExecutorStart_hook, explain_ExecutorEnd(), explain_ExecutorFinish(), explain_ExecutorRun(), explain_ExecutorStart(), EXPLAIN_FORMAT_TEXT, explain_per_node_hook, explain_per_plan_hook, explicit_subtransactions, FATAL, fb(), find_rendezvous_variable(), format_options, g_weak, GetExplainExtensionId(), 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_p, hstoreCheckKeyLen_p, hstoreCheckValLen_p, hstoreCheckValLen_p, hstorePairs_p, hstorePairs_p, hstoreUniquePairs_p, hstoreUniquePairs_p, hstoreUpgrade_p, hstoreUpgrade_p, i, INDEX_MAX_KEYS, init_procedure_caches(), injection_shmem_request(), injection_shmem_startup(), Int32GetDatum(), internal_error, ISBN_index, ISBN_range, ISMN_index, ISMN_range, ISN_DEBUG, ISSN_index, ISSN_range, IsUnderPostmaster, ldap_password_hook, load_external_function(), LOG, loglevel_options, MarkGUCPrefixReserved(), MAX_BLOOM_BITS, MAX_BLOOM_LENGTH, MemoryContextStrdup(), min_password_length, next_exec_check_perms_hook, next_exec_check_perms_hook, next_object_access_hook, next_object_access_hook, next_object_access_hook_str, next_ProcessUtility_hook, next_ProcessUtility_hook, NIL, 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, overexplain_debug_handler(), overexplain_per_node_hook(), overexplain_per_plan_hook(), overexplain_range_table_handler(), pg_bindtextdomain(), pg_plan_advice_advice, pg_plan_advice_advice_check_hook(), pg_plan_advice_always_explain_supplied_advice, pg_plan_advice_always_store_advice_details, pg_plan_advice_explain_option_handler(), pg_plan_advice_explain_per_plan_hook(), pg_plan_advice_feedback_warnings, pg_plan_advice_trace_mask, PGC_POSTMASTER, PGC_SIGHUP, PGC_SUSET, PGC_USERSET, pgfdw_application_name, pgpa_planner_install_hooks(), 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, PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, pgstat_register_kind(), 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_plugin_ptr, plpgsql_print_strict_params, PLPGSQL_RESOLVE_ERROR, plpgsql_subxact_cb(), plpgsql_variable_conflict, plpgsql_xact_cb(), 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, PLy_elog_impl_p, PLy_execution_contexts, PLy_interp_globals, PLyObject_AsString_p, PLyObject_AsString_p, PLyUnicode_FromStringAndSize_p, PLyUnicode_FromStringAndSize_p, PLyUnicode_FromStringAndSize_p, post_parse_analyze_hook, post_planning_lock_id, PQWalReceiverFunctions, prev_check_password_hook, prev_ExecutorEnd, prev_ExecutorEnd, prev_ExecutorFinish, prev_ExecutorFinish, prev_ExecutorRun, prev_ExecutorRun, prev_ExecutorStart, prev_ExecutorStart, prev_explain_per_node_hook, prev_explain_per_plan, prev_explain_per_plan_hook, prev_planner_hook, prev_planner_hook, prev_post_parse_analyze_hook, prev_ProcessUtility, prev_shmem_request_hook, prev_shmem_request_hook, prev_shmem_request_hook, prev_shmem_request_hook, prev_shmem_request_hook, prev_shmem_startup_hook, prev_shmem_startup_hook, prev_shmem_startup_hook, prev_shmem_startup_hook, process_shared_preload_libraries_in_progress, ProcessUtility_hook, PyInit_plpy(), register_label_provider(), RegisterBackgroundWorker(), RegisterCustomRmgr(), RegisterExtensionExplainOption(), 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, test_aio_shmem_request(), test_aio_shmem_startup(), test_lwlock_tranches_shmem_request(), test_plan_advice_advisor(), 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, variable_conflict_options, WalReceiverFunctions, word_similarity_threshold, worker_spi_database, worker_spi_naptime, worker_spi_role, and worker_spi_total_workers.

◆ AggCheckCallContext()

int AggCheckCallContext ( FunctionCallInfo  fcinfo,
MemoryContext aggcontext 
)
extern

Definition at line 4609 of file nodeAgg.c.

4610{
4611 if (fcinfo->context && IsA(fcinfo->context, AggState))
4612 {
4613 if (aggcontext)
4614 {
4615 AggState *aggstate = ((AggState *) fcinfo->context);
4616 ExprContext *cxt = aggstate->curaggcontext;
4617
4618 *aggcontext = cxt->ecxt_per_tuple_memory;
4619 }
4620 return AGG_CONTEXT_AGGREGATE;
4621 }
4622 if (fcinfo->context && IsA(fcinfo->context, WindowAggState))
4623 {
4624 if (aggcontext)
4625 *aggcontext = ((WindowAggState *) fcinfo->context)->curaggcontext;
4626 return AGG_CONTEXT_WINDOW;
4627 }
4628
4629 /* this is just to prevent "uninitialized variable" warnings */
4630 if (aggcontext)
4631 *aggcontext = NULL;
4632 return 0;
4633}
#define AGG_CONTEXT_WINDOW
Definition fmgr.h:815
#define AGG_CONTEXT_AGGREGATE
Definition fmgr.h:814
#define IsA(nodeptr, _type_)
Definition nodes.h:164
MemoryContext ecxt_per_tuple_memory
Definition execnodes.h:293

References AGG_CONTEXT_AGGREGATE, AGG_CONTEXT_WINDOW, FunctionCallInfoBaseData::context, ExprContext::ecxt_per_tuple_memory, fb(), 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(), bytea_string_agg_transfn(), 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(), int4_avg_accum(), int4_avg_accum_inv(), int4_avg_combine(), int8_avg_combine(), int8_avg_deserialize(), int8_avg_serialize(), interval_avg_deserialize(), interval_avg_serialize(), json_agg_finalfn(), json_agg_transfn_worker(), json_object_agg_finalfn(), json_object_agg_transfn_worker(), jsonb_agg_finalfn(), jsonb_agg_transfn_worker(), jsonb_object_agg_finalfn(), jsonb_object_agg_transfn_worker(), makeBoolAggState(), makeInt128AggState(), makeIntervalAggState(), 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()

Aggref * AggGetAggref ( FunctionCallInfo  fcinfo)
extern

Definition at line 4653 of file nodeAgg.c.

4654{
4655 if (fcinfo->context && IsA(fcinfo->context, AggState))
4656 {
4657 AggState *aggstate = (AggState *) fcinfo->context;
4658 AggStatePerAgg curperagg;
4659 AggStatePerTrans curpertrans;
4660
4661 /* check curperagg (valid when in a final function) */
4662 curperagg = aggstate->curperagg;
4663
4664 if (curperagg)
4665 return curperagg->aggref;
4666
4667 /* check curpertrans (valid when in a transition function) */
4668 curpertrans = aggstate->curpertrans;
4669
4670 if (curpertrans)
4671 return curpertrans->aggref;
4672 }
4673 return NULL;
4674}
Aggref * aggref
Definition nodeAgg.h:195

References AggStatePerTransData::aggref, AggStatePerAggData::aggref, FunctionCallInfoBaseData::context, fb(), and IsA.

Referenced by ordered_set_startup().

◆ AggGetTempMemoryContext()

MemoryContext AggGetTempMemoryContext ( FunctionCallInfo  fcinfo)
extern

Definition at line 4687 of file nodeAgg.c.

4688{
4689 if (fcinfo->context && IsA(fcinfo->context, AggState))
4690 {
4691 AggState *aggstate = (AggState *) fcinfo->context;
4692
4693 return aggstate->tmpcontext->ecxt_per_tuple_memory;
4694 }
4695 return NULL;
4696}

References FunctionCallInfoBaseData::context, fb(), and IsA.

◆ AggRegisterCallback()

void AggRegisterCallback ( FunctionCallInfo  fcinfo,
ExprContextCallbackFunction  func,
Datum  arg 
)
extern

Definition at line 4752 of file nodeAgg.c.

4755{
4756 if (fcinfo->context && IsA(fcinfo->context, AggState))
4757 {
4758 AggState *aggstate = (AggState *) fcinfo->context;
4759 ExprContext *cxt = aggstate->curaggcontext;
4760
4761 RegisterExprContextCallback(cxt, func, arg);
4762
4763 return;
4764 }
4765 elog(ERROR, "aggregate function cannot register a callback in this context");
4766}
#define ERROR
Definition elog.h:39
#define elog(elevel,...)
Definition elog.h:227
void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg)
Definition execUtils.c:989

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

Referenced by ordered_set_startup().

◆ AggStateIsShared()

bool AggStateIsShared ( FunctionCallInfo  fcinfo)
extern

Definition at line 4713 of file nodeAgg.c.

4714{
4715 if (fcinfo->context && IsA(fcinfo->context, AggState))
4716 {
4717 AggState *aggstate = (AggState *) fcinfo->context;
4718 AggStatePerAgg curperagg;
4719 AggStatePerTrans curpertrans;
4720
4721 /* check curperagg (valid when in a final function) */
4722 curperagg = aggstate->curperagg;
4723
4724 if (curperagg)
4725 return aggstate->pertrans[curperagg->transno].aggshared;
4726
4727 /* check curpertrans (valid when in a transition function) */
4728 curpertrans = aggstate->curpertrans;
4729
4730 if (curpertrans)
4731 return curpertrans->aggshared;
4732 }
4733 return true;
4734}

References AggStatePerTransData::aggshared, FunctionCallInfoBaseData::context, fb(), IsA, and AggStatePerAggData::transno.

Referenced by ordered_set_startup().

◆ CallerFInfoFunctionCall1()

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

Definition at line 1067 of file fmgr.c.

1068{
1069 LOCAL_FCINFO(fcinfo, 1);
1070 Datum result;
1071
1072 InitFunctionCallInfoData(*fcinfo, flinfo, 1, collation, NULL, NULL);
1073
1074 fcinfo->args[0].value = arg1;
1075 fcinfo->args[0].isnull = false;
1076
1077 result = (*func) (fcinfo);
1078
1079 /* Check for null result, since caller is clearly not expecting one */
1080 if (fcinfo->isnull)
1081 elog(ERROR, "function %p returned NULL", (void *) func);
1082
1083 return result;
1084}
uint32 result
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
Definition fmgr.h:150
#define LOCAL_FCINFO(name, nargs)
Definition fmgr.h:110

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

◆ CallerFInfoFunctionCall2()

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

Definition at line 1087 of file fmgr.c.

1088{
1089 LOCAL_FCINFO(fcinfo, 2);
1090 Datum result;
1091
1092 InitFunctionCallInfoData(*fcinfo, flinfo, 2, collation, NULL, NULL);
1093
1094 fcinfo->args[0].value = arg1;
1095 fcinfo->args[0].isnull = false;
1096 fcinfo->args[1].value = arg2;
1097 fcinfo->args[1].isnull = false;
1098
1099 result = (*func) (fcinfo);
1100
1101 /* Check for null result, since caller is clearly not expecting one */
1102 if (fcinfo->isnull)
1103 elog(ERROR, "function %p returned NULL", (void *) func);
1104
1105 return result;
1106}

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

Referenced by gbt_enum_ssup_cmp(), 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 
)
extern

Definition at line 2111 of file fmgr.c.

2112{
2118
2119 /*
2120 * Get the function's pg_proc entry. Throw a user-facing error for bad
2121 * OID, because validators can be called with user-specified OIDs.
2122 */
2125 ereport(ERROR,
2127 errmsg("function with OID %u does not exist", functionOid)));
2129
2130 /*
2131 * Fetch pg_language entry to know if this is the correct validation
2132 * function for that pg_proc entry.
2133 */
2136 elog(ERROR, "cache lookup failed for language %u", procStruct->prolang);
2138
2139 if (langStruct->lanvalidator != validatorOid)
2140 ereport(ERROR,
2142 errmsg("language validation function %u called for language %u instead of %u",
2143 validatorOid, procStruct->prolang,
2144 langStruct->lanvalidator)));
2145
2146 /* first validate that we have permissions to use the language */
2148 ACL_USAGE);
2149 if (aclresult != ACLCHECK_OK)
2151 NameStr(langStruct->lanname));
2152
2153 /*
2154 * Check whether we are allowed to execute the function itself. If we can
2155 * execute it, there should be no possible side-effect of
2156 * compiling/validation that execution can't have.
2157 */
2159 if (aclresult != ACLCHECK_OK)
2161
2164
2165 return true;
2166}
AclResult
Definition acl.h:183
@ ACLCHECK_OK
Definition acl.h:184
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition aclchk.c:2672
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
Definition aclchk.c:3879
#define NameStr(name)
Definition c.h:835
int errcode(int sqlerrcode)
Definition elog.c:874
#define ereport(elevel,...)
Definition elog.h:151
#define HeapTupleIsValid(tuple)
Definition htup.h:78
static void * GETSTRUCT(const HeapTupleData *tuple)
Oid GetUserId(void)
Definition miscinit.c:470
static char * errmsg
#define ACL_USAGE
Definition parsenodes.h:84
@ OBJECT_LANGUAGE
@ OBJECT_FUNCTION
#define ACL_EXECUTE
Definition parsenodes.h:83
END_CATALOG_STRUCT typedef FormData_pg_language * Form_pg_language
Definition pg_language.h:69
END_CATALOG_STRUCT typedef FormData_pg_proc * Form_pg_proc
Definition pg_proc.h:140
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:265
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Definition syscache.c:221

References ACL_EXECUTE, ACL_USAGE, aclcheck_error(), ACLCHECK_OK, elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_language, Form_pg_proc, GETSTRUCT(), GetUserId(), HeapTupleIsValid, NameStr, object_aclcheck(), OBJECT_FUNCTION, OBJECT_LANGUAGE, ObjectIdGetDatum(), 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 
)
extern

Definition at line 794 of file fmgr.c.

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

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

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

◆ DirectFunctionCall2Coll()

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

Definition at line 814 of file fmgr.c.

815{
816 LOCAL_FCINFO(fcinfo, 2);
818
819 InitFunctionCallInfoData(*fcinfo, NULL, 2, collation, NULL, NULL);
820
821 fcinfo->args[0].value = arg1;
822 fcinfo->args[0].isnull = false;
823 fcinfo->args[1].value = arg2;
824 fcinfo->args[1].isnull = false;
825
826 result = (*func) (fcinfo);
827
828 /* Check for null result, since caller is clearly not expecting one */
829 if (fcinfo->isnull)
830 elog(ERROR, "function %p returned NULL", (void *) func);
831
832 return result;
833}

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

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

◆ DirectFunctionCall3Coll()

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

Definition at line 836 of file fmgr.c.

838{
839 LOCAL_FCINFO(fcinfo, 3);
841
842 InitFunctionCallInfoData(*fcinfo, NULL, 3, collation, NULL, NULL);
843
844 fcinfo->args[0].value = arg1;
845 fcinfo->args[0].isnull = false;
846 fcinfo->args[1].value = arg2;
847 fcinfo->args[1].isnull = false;
848 fcinfo->args[2].value = arg3;
849 fcinfo->args[2].isnull = false;
850
851 result = (*func) (fcinfo);
852
853 /* Check for null result, since caller is clearly not expecting one */
854 if (fcinfo->isnull)
855 elog(ERROR, "function %p returned NULL", (void *) func);
856
857 return result;
858}

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

Referenced by execute_extension_script(), and executeStringInternalMethod().

◆ DirectFunctionCall4Coll()

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

Definition at line 861 of file fmgr.c.

863{
864 LOCAL_FCINFO(fcinfo, 4);
866
867 InitFunctionCallInfoData(*fcinfo, NULL, 4, collation, NULL, NULL);
868
869 fcinfo->args[0].value = arg1;
870 fcinfo->args[0].isnull = false;
871 fcinfo->args[1].value = arg2;
872 fcinfo->args[1].isnull = false;
873 fcinfo->args[2].value = arg3;
874 fcinfo->args[2].isnull = false;
875 fcinfo->args[3].value = arg4;
876 fcinfo->args[3].isnull = false;
877
878 result = (*func) (fcinfo);
879
880 /* Check for null result, since caller is clearly not expecting one */
881 if (fcinfo->isnull)
882 elog(ERROR, "function %p returned NULL", (void *) func);
883
884 return result;
885}

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

Referenced by execute_extension_script().

◆ DirectFunctionCall5Coll()

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

Definition at line 888 of file fmgr.c.

890{
891 LOCAL_FCINFO(fcinfo, 5);
893
894 InitFunctionCallInfoData(*fcinfo, NULL, 5, collation, NULL, NULL);
895
896 fcinfo->args[0].value = arg1;
897 fcinfo->args[0].isnull = false;
898 fcinfo->args[1].value = arg2;
899 fcinfo->args[1].isnull = false;
900 fcinfo->args[2].value = arg3;
901 fcinfo->args[2].isnull = false;
902 fcinfo->args[3].value = arg4;
903 fcinfo->args[3].isnull = false;
904 fcinfo->args[4].value = arg5;
905 fcinfo->args[4].isnull = false;
906
907 result = (*func) (fcinfo);
908
909 /* Check for null result, since caller is clearly not expecting one */
910 if (fcinfo->isnull)
911 elog(ERROR, "function %p returned NULL", (void *) func);
912
913 return result;
914}

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

Referenced by neqjoinsel().

◆ DirectFunctionCall6Coll()

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

Definition at line 917 of file fmgr.c.

920{
921 LOCAL_FCINFO(fcinfo, 6);
923
924 InitFunctionCallInfoData(*fcinfo, NULL, 6, collation, NULL, NULL);
925
926 fcinfo->args[0].value = arg1;
927 fcinfo->args[0].isnull = false;
928 fcinfo->args[1].value = arg2;
929 fcinfo->args[1].isnull = false;
930 fcinfo->args[2].value = arg3;
931 fcinfo->args[2].isnull = false;
932 fcinfo->args[3].value = arg4;
933 fcinfo->args[3].isnull = false;
934 fcinfo->args[4].value = arg5;
935 fcinfo->args[4].isnull = false;
936 fcinfo->args[5].value = arg6;
937 fcinfo->args[5].isnull = false;
938
939 result = (*func) (fcinfo);
940
941 /* Check for null result, since caller is clearly not expecting one */
942 if (fcinfo->isnull)
943 elog(ERROR, "function %p returned NULL", (void *) func);
944
945 return result;
946}

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

◆ DirectFunctionCall7Coll()

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

Definition at line 949 of file fmgr.c.

952{
953 LOCAL_FCINFO(fcinfo, 7);
955
956 InitFunctionCallInfoData(*fcinfo, NULL, 7, collation, NULL, NULL);
957
958 fcinfo->args[0].value = arg1;
959 fcinfo->args[0].isnull = false;
960 fcinfo->args[1].value = arg2;
961 fcinfo->args[1].isnull = false;
962 fcinfo->args[2].value = arg3;
963 fcinfo->args[2].isnull = false;
964 fcinfo->args[3].value = arg4;
965 fcinfo->args[3].isnull = false;
966 fcinfo->args[4].value = arg5;
967 fcinfo->args[4].isnull = false;
968 fcinfo->args[5].value = arg6;
969 fcinfo->args[5].isnull = false;
970 fcinfo->args[6].value = arg7;
971 fcinfo->args[6].isnull = false;
972
973 result = (*func) (fcinfo);
974
975 /* Check for null result, since caller is clearly not expecting one */
976 if (fcinfo->isnull)
977 elog(ERROR, "function %p returned NULL", (void *) func);
978
979 return result;
980}

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

◆ DirectFunctionCall8Coll()

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

Definition at line 983 of file fmgr.c.

986{
987 LOCAL_FCINFO(fcinfo, 8);
989
990 InitFunctionCallInfoData(*fcinfo, NULL, 8, collation, NULL, NULL);
991
992 fcinfo->args[0].value = arg1;
993 fcinfo->args[0].isnull = false;
994 fcinfo->args[1].value = arg2;
995 fcinfo->args[1].isnull = false;
996 fcinfo->args[2].value = arg3;
997 fcinfo->args[2].isnull = false;
998 fcinfo->args[3].value = arg4;
999 fcinfo->args[3].isnull = false;
1000 fcinfo->args[4].value = arg5;
1001 fcinfo->args[4].isnull = false;
1002 fcinfo->args[5].value = arg6;
1003 fcinfo->args[5].isnull = false;
1004 fcinfo->args[6].value = arg7;
1005 fcinfo->args[6].isnull = false;
1006 fcinfo->args[7].value = arg8;
1007 fcinfo->args[7].isnull = false;
1008
1009 result = (*func) (fcinfo);
1010
1011 /* Check for null result, since caller is clearly not expecting one */
1012 if (fcinfo->isnull)
1013 elog(ERROR, "function %p returned NULL", (void *) func);
1014
1015 return result;
1016}

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

◆ 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 
)
extern

Definition at line 1019 of file fmgr.c.

1023{
1024 LOCAL_FCINFO(fcinfo, 9);
1025 Datum result;
1026
1027 InitFunctionCallInfoData(*fcinfo, NULL, 9, collation, NULL, NULL);
1028
1029 fcinfo->args[0].value = arg1;
1030 fcinfo->args[0].isnull = false;
1031 fcinfo->args[1].value = arg2;
1032 fcinfo->args[1].isnull = false;
1033 fcinfo->args[2].value = arg3;
1034 fcinfo->args[2].isnull = false;
1035 fcinfo->args[3].value = arg4;
1036 fcinfo->args[3].isnull = false;
1037 fcinfo->args[4].value = arg5;
1038 fcinfo->args[4].isnull = false;
1039 fcinfo->args[5].value = arg6;
1040 fcinfo->args[5].isnull = false;
1041 fcinfo->args[6].value = arg7;
1042 fcinfo->args[6].isnull = false;
1043 fcinfo->args[7].value = arg8;
1044 fcinfo->args[7].isnull = false;
1045 fcinfo->args[8].value = arg9;
1046 fcinfo->args[8].isnull = false;
1047
1048 result = (*func) (fcinfo);
1049
1050 /* Check for null result, since caller is clearly not expecting one */
1051 if (fcinfo->isnull)
1052 elog(ERROR, "function %p returned NULL", (void *) func);
1053
1054 return result;
1055}

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

◆ DirectInputFunctionCallSafe()

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

Definition at line 1641 of file fmgr.c.

1645{
1646 LOCAL_FCINFO(fcinfo, 3);
1647
1648 if (str == NULL)
1649 {
1650 *result = (Datum) 0; /* just return null result */
1651 return true;
1652 }
1653
1654 InitFunctionCallInfoData(*fcinfo, NULL, 3, InvalidOid, escontext, NULL);
1655
1656 fcinfo->args[0].value = CStringGetDatum(str);
1657 fcinfo->args[0].isnull = false;
1658 fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1659 fcinfo->args[1].isnull = false;
1660 fcinfo->args[2].value = Int32GetDatum(typmod);
1661 fcinfo->args[2].isnull = false;
1662
1663 *result = (*func) (fcinfo);
1664
1665 /* Result value is garbage, and could be null, if an error was reported */
1666 if (SOFT_ERROR_OCCURRED(escontext))
1667 return false;
1668
1669 /* Otherwise, shouldn't get null result */
1670 if (fcinfo->isnull)
1671 elog(ERROR, "input function %p returned NULL", (void *) func);
1672
1673 return true;
1674}
const char * str
#define SOFT_ERROR_OCCURRED(escontext)
Definition miscnodes.h:53
static Datum CStringGetDatum(const char *X)
Definition postgres.h:370
static Datum Int32GetDatum(int32 X)
Definition postgres.h:212
#define InvalidOid

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

Referenced by executeItemOptUnwrapTarget(), jbv_to_infunc_datum(), jsonb_in_scalar(), numeric_float4(), numeric_float8(), parseNumericOid(), to_regclass(), to_regcollation(), to_regdatabase(), to_regnamespace(), to_regoper(), to_regoperator(), to_regproc(), to_regprocedure(), to_regrole(), and to_regtype().

◆ EstimateLibraryStateSpace()

Size EstimateLibraryStateSpace ( void  )
extern

Definition at line 702 of file dfmgr.c.

703{
705 Size size = 1;
706
707 for (file_scanner = file_list;
710 size = add_size(size, strlen(file_scanner->filename) + 1);
711
712 return size;
713}
size_t Size
Definition c.h:689
static DynamicFileList * file_list
Definition dfmgr.c:59
Size add_size(Size s1, Size s2)
Definition shmem.c:518
DynamicFileList * next
Definition dfmgr.c:48

References add_size(), fb(), file_list, and DynamicFileList::next.

Referenced by InitializeParallelDSM().

◆ fetch_finfo_record()

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

Definition at line 457 of file fmgr.c.

458{
459 char *infofuncname;
461 const Pg_finfo_record *inforec;
462
463 infofuncname = psprintf("pg_finfo_%s", funcname);
464
465 /* Try to look up the info function */
468 if (infofunc == NULL)
469 {
472 errmsg("could not find function information for function \"%s\"",
473 funcname),
474 errhint("SQL-callable functions need an accompanying PG_FUNCTION_INFO_V1(funcname).")));
475 return NULL; /* silence compiler */
476 }
477
478 /* Found, so call it */
479 inforec = (*infofunc) ();
480
481 /* Validate result as best we can */
482 if (inforec == NULL)
483 elog(ERROR, "null result from info function \"%s\"", infofuncname);
484 switch (inforec->api_version)
485 {
486 case 1:
487 /* OK, no additional fields to validate */
488 break;
489 default:
492 errmsg("unrecognized API version %d reported by info function \"%s\"",
493 inforec->api_version, infofuncname)));
494 break;
495 }
496
498 return inforec;
499}
void * lookup_external_function(void *filehandle, const char *funcname)
Definition dfmgr.c:171
int errhint(const char *fmt,...) pg_attribute_printf(1
const Pg_finfo_record *(* PGFInfoFunction)(void)
Definition fmgr.h:403
void pfree(void *pointer)
Definition mcxt.c:1616
char * psprintf(const char *fmt,...)
Definition psprintf.c:43
int api_version
Definition fmgr.h:398

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

Referenced by fmgr_c_validator(), and fmgr_info_C_lang().

◆ find_in_path()

char * find_in_path ( const char basename,
const char path,
const char path_param,
const char macro,
const char macro_val 
)
extern

Definition at line 574 of file dfmgr.c.

576{
577 const char *p;
578 size_t baselen;
579
580 Assert(basename != NULL);
582 Assert(path != NULL);
584
585 p = path;
586
587 /*
588 * If the path variable is empty, don't do a path search.
589 */
590 if (strlen(p) == 0)
591 return NULL;
592
593 baselen = strlen(basename);
594
595 for (;;)
596 {
597 size_t len;
598 char *piece;
599 char *mangled;
600 char *full;
601
603 if (piece == p)
606 errmsg("zero-length component in parameter \"%s\"", path_param)));
607
608 if (piece == NULL)
609 len = strlen(p);
610 else
611 len = piece - p;
612
613 piece = palloc(len + 1);
614 strlcpy(piece, p, len + 1);
615
617 pfree(piece);
618
620
621 /* only absolute paths */
625 errmsg("component in parameter \"%s\" is not an absolute path", path_param)));
626
627 full = palloc(strlen(mangled) + 1 + baselen + 1);
628 sprintf(full, "%s/%s", mangled, basename);
629 pfree(mangled);
630
631 elog(DEBUG3, "%s: trying \"%s\"", __func__, full);
632
633 if (pg_file_exists(full))
634 return full;
635
636 pfree(full);
637
638 if (p[len] == '\0')
639 break;
640 else
641 p += len + 1;
642 }
643
644 return NULL;
645}
#define Assert(condition)
Definition c.h:943
char * substitute_path_macro(const char *str, const char *macro, const char *value)
Definition dfmgr.c:536
#define DEBUG3
Definition elog.h:28
bool pg_file_exists(const char *name)
Definition fd.c:504
void * palloc(Size size)
Definition mcxt.c:1387
const void size_t len
#define is_absolute_path(filename)
Definition port.h:104
#define sprintf
Definition port.h:262
char * first_path_var_separator(const char *pathlist)
Definition path.c:127
void canonicalize_path(char *path)
Definition path.c:337
char * first_dir_separator(const char *filename)
Definition path.c:110
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition strlcpy.c:45

References Assert, canonicalize_path(), DEBUG3, elog, ereport, errcode(), errmsg, ERROR, fb(), first_dir_separator(), first_path_var_separator(), is_absolute_path, len, palloc(), pfree(), pg_file_exists(), sprintf, strlcpy(), and substitute_path_macro().

Referenced by expand_dynamic_library_name().

◆ find_rendezvous_variable()

void ** find_rendezvous_variable ( const char varName)
extern

Definition at line 664 of file dfmgr.c.

665{
666 static HTAB *rendezvousHash = NULL;
667
669 bool found;
670
671 /* Create a hashtable if we haven't already done so in this process */
672 if (rendezvousHash == NULL)
673 {
674 HASHCTL ctl;
675
677 ctl.entrysize = sizeof(rendezvousHashEntry);
678 rendezvousHash = hash_create("Rendezvous variable hash",
679 16,
680 &ctl,
682 }
683
684 /* Find or create the hashtable entry for this varName */
686 varName,
688 &found);
689
690 /* Initialize to NULL if first time */
691 if (!found)
692 hentry->varValue = NULL;
693
694 return &hentry->varValue;
695}
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition dynahash.c:888
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
Definition dynahash.c:359
#define HASH_STRINGS
Definition hsearch.h:91
@ HASH_ENTER
Definition hsearch.h:109
#define HASH_ELEM
Definition hsearch.h:90
tree ctl
Definition radixtree.h:1838
Size keysize
Definition hsearch.h:69

References ctl, fb(), hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASH_STRINGS, HASHCTL::keysize, and NAMEDATALEN.

Referenced by _PG_init().

◆ fmgr_info()

void fmgr_info ( Oid  functionId,
FmgrInfo finfo 
)
extern

Definition at line 129 of file fmgr.c.

130{
132}
static void fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, bool ignore_security)
Definition fmgr.c:149
MemoryContext CurrentMemoryContext
Definition mcxt.c:160

References CurrentMemoryContext, fb(), and fmgr_info_cxt_security().

Referenced by _bt_find_extreme_element(), _bt_saoparray_shrink(), _bt_skiparray_strat_decrement(), _bt_skiparray_strat_increment(), _sv_to_datum_finfo(), attribute_statistics_update(), brin_minmax_multi_summary_out(), brin_page_items(), build_pertrans_for_aggref(), call_pltcl_start_proc(), CompareOpclassOptions(), compute_distinct_stats(), CopyFromBinaryInFunc(), CopyFromTextLikeInFunc(), CopyToBinaryOutFunc(), CopyToTextLikeOutFunc(), create_foreign_modify(), eqjoinsel(), eqjoinsel_find_matches(), EventTriggerInvoke(), ExecBuildGroupingEqual(), ExecBuildHash32Expr(), ExecBuildParamSetEqual(), ExecCallTriggerFunc(), ExecEvalHashedScalarArrayOp(), ExecForPortionOfLeftovers(), ExecInitAgg(), ExecInitExprRec(), ExecInitFunc(), ExecInitHashJoin(), ExecInitJsonExpr(), ExecInitMemoize(), ExecInitSubPlan(), ExecInitTableFuncScan(), ExecInitWindowAgg(), execTuplesHashPrepare(), ExecuteCallStmt(), fetch_fp_info(), generic_restriction_selectivity(), get_stats_slot_range(), gincost_pattern(), hash_array(), import_expressions(), 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(), serialize_prepare_info(), statext_mcv_import(), text_format(), TupleDescGetAttInMetadata(), and var_eq_const().

◆ fmgr_info_copy()

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

◆ fmgr_info_cxt()

◆ fmgr_internal_function()

Oid fmgr_internal_function ( const char proname)
extern

Definition at line 597 of file fmgr.c.

598{
600
601 if (fbp == NULL)
602 return InvalidOid;
603 return fbp->foid;
604}
static const FmgrBuiltin * fmgr_lookupByName(const char *name)
Definition fmgr.c:103
NameData proname
Definition pg_proc.h:37

References fb(), fmgr_lookupByName(), InvalidOid, and proname.

Referenced by fmgr_internal_validator().

◆ fmgr_symbol()

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

Definition at line 283 of file fmgr.c.

284{
289
292 elog(ERROR, "cache lookup failed for function %u", functionId);
294
295 if (procedureStruct->prosecdef ||
298 {
299 *mod = NULL; /* core binary */
300 *fn = pstrdup("fmgr_security_definer");
302 return;
303 }
304
305 /* see fmgr_info_cxt_security for the individual cases */
306 switch (procedureStruct->prolang)
307 {
311
312 *mod = NULL; /* core binary */
314 break;
315
316 case ClanguageId:
319
322
323 /*
324 * No need to check symbol presence / API version here, already
325 * checked in fmgr_info_cxt_security.
326 */
329 break;
330
331 case SQLlanguageId:
332 *mod = NULL; /* core binary */
333 *fn = pstrdup("fmgr_sql");
334 break;
335
336 default:
337 *mod = NULL;
338 *fn = NULL; /* unknown, pass pointer */
339 break;
340 }
341
343}
#define TextDatumGetCString(d)
Definition builtins.h:99
#define FmgrHookIsNeeded(fn_oid)
Definition fmgr.h:850
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
Definition heaptuple.c:456
char * pstrdup(const char *in)
Definition mcxt.c:1781
Datum SysCacheGetAttrNotNull(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber)
Definition syscache.c:626
static void * fn(void *arg)

References elog, ERROR, fb(), FmgrHookIsNeeded, fn(), Form_pg_proc, GETSTRUCT(), heap_attisnull(), HeapTupleIsValid, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttrNotNull(), and TextDatumGetCString.

Referenced by llvm_function_reference().

◆ FunctionCall0Coll()

Datum FunctionCall0Coll ( FmgrInfo flinfo,
Oid  collation 
)
extern

Definition at line 1114 of file fmgr.c.

1115{
1116 LOCAL_FCINFO(fcinfo, 0);
1117 Datum result;
1118
1119 InitFunctionCallInfoData(*fcinfo, flinfo, 0, collation, NULL, NULL);
1120
1121 result = FunctionCallInvoke(fcinfo);
1122
1123 /* Check for null result, since caller is clearly not expecting one */
1124 if (fcinfo->isnull)
1125 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1126
1127 return result;
1128}
#define FunctionCallInvoke(fcinfo)
Definition fmgr.h:172
Oid fn_oid
Definition fmgr.h:59

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

Referenced by OidFunctionCall0Coll().

◆ FunctionCall1Coll()

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

Definition at line 1131 of file fmgr.c.

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

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

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

◆ FunctionCall2Coll()

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

Definition at line 1151 of file fmgr.c.

1152{
1153 LOCAL_FCINFO(fcinfo, 2);
1154 Datum result;
1155
1156 InitFunctionCallInfoData(*fcinfo, flinfo, 2, collation, NULL, NULL);
1157
1158 fcinfo->args[0].value = arg1;
1159 fcinfo->args[0].isnull = false;
1160 fcinfo->args[1].value = arg2;
1161 fcinfo->args[1].isnull = false;
1162
1163 result = FunctionCallInvoke(fcinfo);
1164
1165 /* Check for null result, since caller is clearly not expecting one */
1166 if (fcinfo->isnull)
1167 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1168
1169 return result;
1170}

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

Referenced by _bt_array_decrement(), _bt_array_increment(), _bt_binsrch_skiparray_skey(), _bt_check_compare(), _bt_check_rowcompare(), _bt_compare(), _bt_compare_array_elements(), _bt_compare_array_skey(), _bt_compare_scankey_args(), _bt_find_extreme_element(), _bt_keep_natts(), _bt_set_startikey(), _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(), CompareOpclassOptions(), compute_distinct_stats(), compute_partition_hash_value(), compute_range_stats(), create_range_bounds(), doPickSplit(), element_compare(), element_compare(), ExecEvalPreOrderedDistinctSingle(), execTuplesUnequal(), find_value_in_new_partitions_list(), genericPickSplit(), get_distance(), get_distance(), get_partition_for_tuple(), get_position(), 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(), partitions_listdatum_intersection(), process_ordered_aggregate_single(), qsort_partition_list_value_cmp(), range_cmp_bound_values(), range_cmp_bounds(), range_contains_elem_internal(), range_contains_value(), recheck_matched_pk_tuple(), ri_CompareWithCast(), ri_FastPathFlushArray(), satisfies_hash_partition(), spgdoinsert(), spgGetCache(), spgInnerTest(), spgLeafTest(), and tuples_equal().

◆ FunctionCall3Coll()

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

Definition at line 1173 of file fmgr.c.

1175{
1176 LOCAL_FCINFO(fcinfo, 3);
1177 Datum result;
1178
1179 InitFunctionCallInfoData(*fcinfo, flinfo, 3, collation, NULL, NULL);
1180
1181 fcinfo->args[0].value = arg1;
1182 fcinfo->args[0].isnull = false;
1183 fcinfo->args[1].value = arg2;
1184 fcinfo->args[1].isnull = false;
1185 fcinfo->args[2].value = arg3;
1186 fcinfo->args[2].isnull = false;
1187
1188 result = FunctionCallInvoke(fcinfo);
1189
1190 /* Check for null result, since caller is clearly not expecting one */
1191 if (fcinfo->isnull)
1192 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1193
1194 return result;
1195}

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

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 
)
extern

Definition at line 1198 of file fmgr.c.

1200{
1201 LOCAL_FCINFO(fcinfo, 4);
1202 Datum result;
1203
1204 InitFunctionCallInfoData(*fcinfo, flinfo, 4, collation, NULL, NULL);
1205
1206 fcinfo->args[0].value = arg1;
1207 fcinfo->args[0].isnull = false;
1208 fcinfo->args[1].value = arg2;
1209 fcinfo->args[1].isnull = false;
1210 fcinfo->args[2].value = arg3;
1211 fcinfo->args[2].isnull = false;
1212 fcinfo->args[3].value = arg4;
1213 fcinfo->args[3].isnull = false;
1214
1215 result = FunctionCallInvoke(fcinfo);
1216
1217 /* Check for null result, since caller is clearly not expecting one */
1218 if (fcinfo->isnull)
1219 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1220
1221 return result;
1222}

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

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 
)
extern

Definition at line 1225 of file fmgr.c.

1227{
1228 LOCAL_FCINFO(fcinfo, 5);
1229 Datum result;
1230
1231 InitFunctionCallInfoData(*fcinfo, flinfo, 5, collation, NULL, NULL);
1232
1233 fcinfo->args[0].value = arg1;
1234 fcinfo->args[0].isnull = false;
1235 fcinfo->args[1].value = arg2;
1236 fcinfo->args[1].isnull = false;
1237 fcinfo->args[2].value = arg3;
1238 fcinfo->args[2].isnull = false;
1239 fcinfo->args[3].value = arg4;
1240 fcinfo->args[3].isnull = false;
1241 fcinfo->args[4].value = arg5;
1242 fcinfo->args[4].isnull = false;
1243
1244 result = FunctionCallInvoke(fcinfo);
1245
1246 /* Check for null result, since caller is clearly not expecting one */
1247 if (fcinfo->isnull)
1248 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1249
1250 return result;
1251}

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

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 
)
extern

Definition at line 1254 of file fmgr.c.

1257{
1258 LOCAL_FCINFO(fcinfo, 6);
1259 Datum result;
1260
1261 InitFunctionCallInfoData(*fcinfo, flinfo, 6, collation, NULL, NULL);
1262
1263 fcinfo->args[0].value = arg1;
1264 fcinfo->args[0].isnull = false;
1265 fcinfo->args[1].value = arg2;
1266 fcinfo->args[1].isnull = false;
1267 fcinfo->args[2].value = arg3;
1268 fcinfo->args[2].isnull = false;
1269 fcinfo->args[3].value = arg4;
1270 fcinfo->args[3].isnull = false;
1271 fcinfo->args[4].value = arg5;
1272 fcinfo->args[4].isnull = false;
1273 fcinfo->args[5].value = arg6;
1274 fcinfo->args[5].isnull = false;
1275
1276 result = FunctionCallInvoke(fcinfo);
1277
1278 /* Check for null result, since caller is clearly not expecting one */
1279 if (fcinfo->isnull)
1280 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1281
1282 return result;
1283}

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

Referenced by OidFunctionCall6Coll().

◆ FunctionCall7Coll()

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

Definition at line 1286 of file fmgr.c.

1289{
1290 LOCAL_FCINFO(fcinfo, 7);
1291 Datum result;
1292
1293 InitFunctionCallInfoData(*fcinfo, flinfo, 7, collation, NULL, NULL);
1294
1295 fcinfo->args[0].value = arg1;
1296 fcinfo->args[0].isnull = false;
1297 fcinfo->args[1].value = arg2;
1298 fcinfo->args[1].isnull = false;
1299 fcinfo->args[2].value = arg3;
1300 fcinfo->args[2].isnull = false;
1301 fcinfo->args[3].value = arg4;
1302 fcinfo->args[3].isnull = false;
1303 fcinfo->args[4].value = arg5;
1304 fcinfo->args[4].isnull = false;
1305 fcinfo->args[5].value = arg6;
1306 fcinfo->args[5].isnull = false;
1307 fcinfo->args[6].value = arg7;
1308 fcinfo->args[6].isnull = false;
1309
1310 result = FunctionCallInvoke(fcinfo);
1311
1312 /* Check for null result, since caller is clearly not expecting one */
1313 if (fcinfo->isnull)
1314 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1315
1316 return result;
1317}

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

Referenced by directTriConsistentFn(), gincost_pattern(), ginNewScanKey(), 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 
)
extern

Definition at line 1320 of file fmgr.c.

1323{
1324 LOCAL_FCINFO(fcinfo, 8);
1325 Datum result;
1326
1327 InitFunctionCallInfoData(*fcinfo, flinfo, 8, collation, NULL, NULL);
1328
1329 fcinfo->args[0].value = arg1;
1330 fcinfo->args[0].isnull = false;
1331 fcinfo->args[1].value = arg2;
1332 fcinfo->args[1].isnull = false;
1333 fcinfo->args[2].value = arg3;
1334 fcinfo->args[2].isnull = false;
1335 fcinfo->args[3].value = arg4;
1336 fcinfo->args[3].isnull = false;
1337 fcinfo->args[4].value = arg5;
1338 fcinfo->args[4].isnull = false;
1339 fcinfo->args[5].value = arg6;
1340 fcinfo->args[5].isnull = false;
1341 fcinfo->args[6].value = arg7;
1342 fcinfo->args[6].isnull = false;
1343 fcinfo->args[7].value = arg8;
1344 fcinfo->args[7].isnull = false;
1345
1346 result = FunctionCallInvoke(fcinfo);
1347
1348 /* Check for null result, since caller is clearly not expecting one */
1349 if (fcinfo->isnull)
1350 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1351
1352 return result;
1353}

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

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 
)
extern

Definition at line 1356 of file fmgr.c.

1360{
1361 LOCAL_FCINFO(fcinfo, 9);
1362 Datum result;
1363
1364 InitFunctionCallInfoData(*fcinfo, flinfo, 9, collation, NULL, NULL);
1365
1366 fcinfo->args[0].value = arg1;
1367 fcinfo->args[0].isnull = false;
1368 fcinfo->args[1].value = arg2;
1369 fcinfo->args[1].isnull = false;
1370 fcinfo->args[2].value = arg3;
1371 fcinfo->args[2].isnull = false;
1372 fcinfo->args[3].value = arg4;
1373 fcinfo->args[3].isnull = false;
1374 fcinfo->args[4].value = arg5;
1375 fcinfo->args[4].isnull = false;
1376 fcinfo->args[5].value = arg6;
1377 fcinfo->args[5].isnull = false;
1378 fcinfo->args[6].value = arg7;
1379 fcinfo->args[6].isnull = false;
1380 fcinfo->args[7].value = arg8;
1381 fcinfo->args[7].isnull = false;
1382 fcinfo->args[8].value = arg9;
1383 fcinfo->args[8].isnull = false;
1384
1385 result = FunctionCallInvoke(fcinfo);
1386
1387 /* Check for null result, since caller is clearly not expecting one */
1388 if (fcinfo->isnull)
1389 elog(ERROR, "function %u returned NULL", flinfo->fn_oid);
1390
1391 return result;
1392}

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

Referenced by OidFunctionCall9Coll().

◆ get_call_expr_arg_stable()

bool get_call_expr_arg_stable ( Node expr,
int  argnum 
)
extern

Definition at line 1960 of file fmgr.c.

1961{
1962 List *args;
1963 Node *arg;
1964
1965 if (expr == NULL)
1966 return false;
1967
1968 if (IsA(expr, FuncExpr))
1969 args = ((FuncExpr *) expr)->args;
1970 else if (IsA(expr, OpExpr))
1971 args = ((OpExpr *) expr)->args;
1972 else if (IsA(expr, DistinctExpr))
1973 args = ((DistinctExpr *) expr)->args;
1974 else if (IsA(expr, ScalarArrayOpExpr))
1975 args = ((ScalarArrayOpExpr *) expr)->args;
1976 else if (IsA(expr, NullIfExpr))
1977 args = ((NullIfExpr *) expr)->args;
1978 else if (IsA(expr, WindowFunc))
1979 args = ((WindowFunc *) expr)->args;
1980 else
1981 return false;
1982
1984 return false;
1985
1986 arg = (Node *) list_nth(args, argnum);
1987
1988 /*
1989 * Either a true Const or an external Param will have a value that doesn't
1990 * change during the execution of the query. In future we might want to
1991 * consider other cases too, e.g. now().
1992 */
1993 if (IsA(arg, Const))
1994 return true;
1995 if (IsA(arg, Param) &&
1996 ((Param *) arg)->paramkind == PARAM_EXTERN)
1997 return true;
1998
1999 return false;
2000}
static int list_length(const List *l)
Definition pg_list.h:152
static void * list_nth(const List *list, int n)
Definition pg_list.h:331
@ PARAM_EXTERN
Definition primnodes.h:385
Definition pg_list.h:54
Definition nodes.h:135

References arg, fb(), IsA, list_length(), list_nth(), and PARAM_EXTERN.

Referenced by get_fn_expr_arg_stable().

◆ get_call_expr_argtype()

Oid get_call_expr_argtype ( Node expr,
int  argnum 
)
extern

Definition at line 1895 of file fmgr.c.

1896{
1897 List *args;
1898 Oid argtype;
1899
1900 if (expr == NULL)
1901 return InvalidOid;
1902
1903 if (IsA(expr, FuncExpr))
1904 args = ((FuncExpr *) expr)->args;
1905 else if (IsA(expr, OpExpr))
1906 args = ((OpExpr *) expr)->args;
1907 else if (IsA(expr, DistinctExpr))
1908 args = ((DistinctExpr *) expr)->args;
1909 else if (IsA(expr, ScalarArrayOpExpr))
1910 args = ((ScalarArrayOpExpr *) expr)->args;
1911 else if (IsA(expr, NullIfExpr))
1912 args = ((NullIfExpr *) expr)->args;
1913 else if (IsA(expr, WindowFunc))
1914 args = ((WindowFunc *) expr)->args;
1915 else
1916 return InvalidOid;
1917
1919 return InvalidOid;
1920
1921 argtype = exprType((Node *) list_nth(args, argnum));
1922
1923 /*
1924 * special hack for ScalarArrayOpExpr: what the underlying function will
1925 * actually get passed is the element type of the array.
1926 */
1927 if (IsA(expr, ScalarArrayOpExpr) &&
1928 argnum == 1)
1929 argtype = get_base_element_type(argtype);
1930
1931 return argtype;
1932}
Oid get_base_element_type(Oid typid)
Definition lsyscache.c:3054
Oid exprType(const Node *expr)
Definition nodeFuncs.c:42

References exprType(), fb(), get_base_element_type(), InvalidOid, IsA, list_length(), and list_nth().

Referenced by cfunc_resolve_polymorphic_argtypes(), get_fn_expr_argtype(), prepare_sql_fn_parse_info(), resolve_polymorphic_argtypes(), and resolve_polymorphic_tupdesc().

◆ get_first_loaded_module()

DynamicFileList * get_first_loaded_module ( void  )
extern

Definition at line 425 of file dfmgr.c.

426{
427 return file_list;
428}

References file_list.

Referenced by pg_get_loaded_modules().

◆ get_fn_expr_arg_stable()

bool get_fn_expr_arg_stable ( FmgrInfo flinfo,
int  argnum 
)
extern

Definition at line 1941 of file fmgr.c.

1942{
1943 /*
1944 * can't return anything useful if we have no FmgrInfo or if its fn_expr
1945 * node has not been initialized
1946 */
1947 if (!flinfo || !flinfo->fn_expr)
1948 return false;
1949
1950 return get_call_expr_arg_stable(flinfo->fn_expr, argnum);
1951}
bool get_call_expr_arg_stable(Node *expr, int argnum)
Definition fmgr.c:1960
Node * fn_expr
Definition fmgr.h:66

References fb(), fmgr_security_definer_cache::flinfo, 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)
extern

Definition at line 1854 of file fmgr.c.

1855{
1856 Node *expr;
1857
1858 /*
1859 * can't return anything useful if we have no FmgrInfo or if its fn_expr
1860 * node has not been initialized
1861 */
1862 if (!flinfo || !flinfo->fn_expr)
1863 return InvalidOid;
1864
1865 expr = flinfo->fn_expr;
1866
1867 return exprType(expr);
1868}

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

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

◆ get_fn_expr_variadic()

bool get_fn_expr_variadic ( FmgrInfo flinfo)
extern

Definition at line 2010 of file fmgr.c.

2011{
2012 Node *expr;
2013
2014 /*
2015 * can't return anything useful if we have no FmgrInfo or if its fn_expr
2016 * node has not been initialized
2017 */
2018 if (!flinfo || !flinfo->fn_expr)
2019 return false;
2020
2021 expr = flinfo->fn_expr;
2022
2023 if (IsA(expr, FuncExpr))
2024 return ((FuncExpr *) expr)->funcvariadic;
2025 else
2026 return false;
2027}

References fmgr_security_definer_cache::flinfo, 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)
extern

Definition at line 2063 of file fmgr.c.

2064{
2065 if (flinfo && flinfo->fn_expr && IsA(flinfo->fn_expr, Const))
2066 {
2067 Const *expr = (Const *) flinfo->fn_expr;
2068
2069 if (expr->consttype == BYTEAOID)
2070 return expr->constisnull ? NULL : DatumGetByteaP(expr->constvalue);
2071 }
2072
2073 ereport(ERROR,
2075 errmsg("operator class options info is absent in function call context")));
2076
2077 return NULL;
2078}
#define DatumGetByteaP(X)
Definition fmgr.h:332

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

◆ get_loaded_module_details()

void get_loaded_module_details ( DynamicFileList dfptr,
const char **  library_path,
const char **  module_name,
const char **  module_version 
)
extern

Definition at line 445 of file dfmgr.c.

449{
450 *library_path = dfptr->filename;
451 *module_name = dfptr->magic->name;
452 *module_version = dfptr->magic->version;
453}

References fb(), and DynamicFileList::filename.

Referenced by pg_get_loaded_modules().

◆ get_next_loaded_module()

DynamicFileList * get_next_loaded_module ( DynamicFileList dfptr)
extern

Definition at line 431 of file dfmgr.c.

432{
433 return dfptr->next;
434}

References fb(), and DynamicFileList::next.

Referenced by pg_get_loaded_modules().

◆ has_fn_opclass_options()

bool has_fn_opclass_options ( FmgrInfo flinfo)
extern

Definition at line 2047 of file fmgr.c.

2048{
2049 if (flinfo && flinfo->fn_expr && IsA(flinfo->fn_expr, Const))
2050 {
2051 Const *expr = (Const *) flinfo->fn_expr;
2052
2053 if (expr->consttype == BYTEAOID)
2054 return !expr->constisnull;
2055 }
2056 return false;
2057}

References Const::consttype, fb(), fmgr_security_definer_cache::flinfo, FmgrInfo::fn_expr, and IsA.

◆ InputFunctionCall()

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

Definition at line 1532 of file fmgr.c.

1533{
1534 LOCAL_FCINFO(fcinfo, 3);
1535 Datum result;
1536
1537 if (str == NULL && flinfo->fn_strict)
1538 return (Datum) 0; /* just return null result */
1539
1540 InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, NULL, NULL);
1541
1542 fcinfo->args[0].value = CStringGetDatum(str);
1543 fcinfo->args[0].isnull = false;
1544 fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1545 fcinfo->args[1].isnull = false;
1546 fcinfo->args[2].value = Int32GetDatum(typmod);
1547 fcinfo->args[2].isnull = false;
1548
1549 result = FunctionCallInvoke(fcinfo);
1550
1551 /* Should get null result if and only if str is NULL */
1552 if (str == NULL)
1553 {
1554 if (!fcinfo->isnull)
1555 elog(ERROR, "input function %u returned non-NULL",
1556 flinfo->fn_oid);
1557 }
1558 else
1559 {
1560 if (fcinfo->isnull)
1561 elog(ERROR, "input function %u returned NULL",
1562 flinfo->fn_oid);
1563 }
1564
1565 return result;
1566}
bool fn_strict
Definition fmgr.h:61

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

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

◆ InputFunctionCallSafe()

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

Definition at line 1586 of file fmgr.c.

1590{
1591 LOCAL_FCINFO(fcinfo, 3);
1592
1593 if (str == NULL && flinfo->fn_strict)
1594 {
1595 *result = (Datum) 0; /* just return null result */
1596 return true;
1597 }
1598
1599 InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, escontext, NULL);
1600
1601 fcinfo->args[0].value = CStringGetDatum(str);
1602 fcinfo->args[0].isnull = false;
1603 fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1604 fcinfo->args[1].isnull = false;
1605 fcinfo->args[2].value = Int32GetDatum(typmod);
1606 fcinfo->args[2].isnull = false;
1607
1608 *result = FunctionCallInvoke(fcinfo);
1609
1610 /* Result value is garbage, and could be null, if an error was reported */
1611 if (SOFT_ERROR_OCCURRED(escontext))
1612 return false;
1613
1614 /* Otherwise, should get null result if and only if str is NULL */
1615 if (str == NULL)
1616 {
1617 if (!fcinfo->isnull)
1618 elog(ERROR, "input function %u returned non-NULL",
1619 flinfo->fn_oid);
1620 }
1621 else
1622 {
1623 if (fcinfo->isnull)
1624 elog(ERROR, "input function %u returned NULL",
1625 flinfo->fn_oid);
1626 }
1627
1628 return true;
1629}

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

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

◆ load_external_function()

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

Definition at line 95 of file dfmgr.c.

97{
98 char *fullname;
99 void *lib_handle;
100 void *retval;
101
102 /*
103 * For extensions with hardcoded '$libdir/' library names, we strip the
104 * prefix to allow the library search path to be used. This is done only
105 * for simple names (e.g., "$libdir/foo"), not for nested paths (e.g.,
106 * "$libdir/foo/bar").
107 *
108 * For nested paths, 'expand_dynamic_library_name' directly expands the
109 * '$libdir' macro, so we leave them untouched.
110 */
111 if (strncmp(filename, "$libdir/", 8) == 0)
112 {
114 filename += 8;
115 }
116
117 /* Expand the possibly-abbreviated filename to an exact path name */
119
120 /* Load the shared library, unless we already did */
122
123 /* Return handle if caller wants it */
124 if (filehandle)
126
127 /* Look up the function within the library. */
128 retval = dlsym(lib_handle, funcname);
129
130 if (retval == NULL && signalNotFound)
133 errmsg("could not find function \"%s\" in file \"%s\"",
134 funcname, fullname)));
135
137 return retval;
138}
static char * expand_dynamic_library_name(const char *name)
Definition dfmgr.c:466
static void * internal_load_library(const char *libname)
Definition dfmgr.c:189
static char * filename
Definition pg_dumpall.c:133
void * dlsym(void *handle, const char *symbol)
Definition win32dlopen.c:61

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

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

◆ load_file()

void load_file ( const char filename,
bool  restricted 
)
extern

Definition at line 149 of file dfmgr.c.

150{
151 char *fullname;
152
153 /* Apply security restriction if requested */
154 if (restricted)
156
157 /* Expand the possibly-abbreviated filename to an exact path name */
159
160 /* Load the shared library, unless we already did */
162
164}
static bool restricted
Definition command.c:199
static void check_restricted_library_name(const char *name)
Definition dfmgr.c:521

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

Referenced by AlterSubscription(), AlterSubscription_refresh(), AlterSubscription_refresh_seq(), CreateSubscription(), DropSubscription(), load_libraries(), pg_sync_replication_slots(), ReplicationSlotDropAtPubNode(), ReplSlotSyncWorkerMain(), SetupApplyOrSyncWorker(), standard_ProcessUtility(), and WalReceiverMain().

◆ lookup_external_function()

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

Definition at line 171 of file dfmgr.c.

172{
173 return dlsym(filehandle, funcname);
174}

References dlsym(), fb(), and funcname.

Referenced by fetch_finfo_record().

◆ OidFunctionCall0Coll()

Datum OidFunctionCall0Coll ( Oid  functionId,
Oid  collation 
)
extern

Definition at line 1403 of file fmgr.c.

1404{
1405 FmgrInfo flinfo;
1406
1407 fmgr_info(functionId, &flinfo);
1408
1409 return FunctionCall0Coll(&flinfo, collation);
1410}
void fmgr_info(Oid functionId, FmgrInfo *finfo)
Definition fmgr.c:129
Datum FunctionCall0Coll(FmgrInfo *flinfo, Oid collation)
Definition fmgr.c:1114

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

◆ OidFunctionCall1Coll()

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

Definition at line 1413 of file fmgr.c.

1414{
1415 FmgrInfo flinfo;
1416
1417 fmgr_info(functionId, &flinfo);
1418
1419 return FunctionCall1Coll(&flinfo, collation, arg1);
1420}
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
Definition fmgr.c:1131

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

Referenced by _bt_allequalimage(), _hash_datum2hashkey_type(), create_grouping_expr_infos(), gisttranslatecmptype(), and init_grouping_targets().

◆ OidFunctionCall2Coll()

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

Definition at line 1423 of file fmgr.c.

1424{
1425 FmgrInfo flinfo;
1426
1427 fmgr_info(functionId, &flinfo);
1428
1429 return FunctionCall2Coll(&flinfo, collation, arg1, arg2);
1430}
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition fmgr.c:1151

References fb(), 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 
)
extern

Definition at line 1433 of file fmgr.c.

1435{
1436 FmgrInfo flinfo;
1437
1438 fmgr_info(functionId, &flinfo);
1439
1440 return FunctionCall3Coll(&flinfo, collation, arg1, arg2, arg3);
1441}
Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)
Definition fmgr.c:1173

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

◆ OidFunctionCall4Coll()

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

Definition at line 1444 of file fmgr.c.

1446{
1447 FmgrInfo flinfo;
1448
1449 fmgr_info(functionId, &flinfo);
1450
1451 return FunctionCall4Coll(&flinfo, collation, arg1, arg2, arg3, arg4);
1452}
Datum FunctionCall4Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4)
Definition fmgr.c:1198

References fb(), 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 
)
extern

Definition at line 1455 of file fmgr.c.

1457{
1458 FmgrInfo flinfo;
1459
1460 fmgr_info(functionId, &flinfo);
1461
1462 return FunctionCall5Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5);
1463}
Datum FunctionCall5Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5)
Definition fmgr.c:1225

References fb(), 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 
)
extern

Definition at line 1466 of file fmgr.c.

1469{
1470 FmgrInfo flinfo;
1471
1472 fmgr_info(functionId, &flinfo);
1473
1474 return FunctionCall6Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1475 arg6);
1476}
Datum FunctionCall6Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6)
Definition fmgr.c:1254

References fb(), 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 
)
extern

Definition at line 1479 of file fmgr.c.

1482{
1483 FmgrInfo flinfo;
1484
1485 fmgr_info(functionId, &flinfo);
1486
1487 return FunctionCall7Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1488 arg6, arg7);
1489}
Datum FunctionCall7Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3, Datum arg4, Datum arg5, Datum arg6, Datum arg7)
Definition fmgr.c:1286

References fb(), 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 
)
extern

Definition at line 1492 of file fmgr.c.

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

References fb(), 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 
)
extern

Definition at line 1505 of file fmgr.c.

1509{
1510 FmgrInfo flinfo;
1511
1512 fmgr_info(functionId, &flinfo);
1513
1514 return FunctionCall9Coll(&flinfo, collation, arg1, arg2, arg3, arg4, arg5,
1515 arg6, arg7, arg8, arg9);
1516}
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:1356

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

◆ OidInputFunctionCall()

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

Definition at line 1755 of file fmgr.c.

1756{
1757 FmgrInfo flinfo;
1758
1759 fmgr_info(functionId, &flinfo);
1760 return InputFunctionCall(&flinfo, str, typioparam, typmod);
1761}
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
Definition fmgr.c:1532

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

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

◆ OidOutputFunctionCall()

◆ OidReceiveFunctionCall()

Datum OidReceiveFunctionCall ( Oid  functionId,
StringInfo  buf,
Oid  typioparam,
int32  typmod 
)
extern

Definition at line 1773 of file fmgr.c.

1775{
1776 FmgrInfo flinfo;
1777
1778 fmgr_info(functionId, &flinfo);
1779 return ReceiveFunctionCall(&flinfo, buf, typioparam, typmod);
1780}
Datum ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf, Oid typioparam, int32 typmod)
Definition fmgr.c:1698
static char buf[DEFAULT_XLOG_SEG_SIZE]

References buf, fb(), 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 
)
extern

Definition at line 1783 of file fmgr.c.

1784{
1785 FmgrInfo flinfo;
1786
1787 fmgr_info(functionId, &flinfo);
1788 return SendFunctionCall(&flinfo, val);
1789}
bytea * SendFunctionCall(FmgrInfo *flinfo, Datum val)
Definition fmgr.c:1745

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

Referenced by logicalrep_write_tuple(), and SendFunctionResult().

◆ OutputFunctionCall()

◆ pg_detoast_datum()

varlena * pg_detoast_datum ( varlena datum)
extern

Definition at line 1798 of file fmgr.c.

1799{
1800 if (VARATT_IS_EXTENDED(datum))
1801 return detoast_attr(datum);
1802 else
1803 return datum;
1804}
varlena * detoast_attr(varlena *attr)
Definition detoast.c:116
static bool VARATT_IS_EXTENDED(const void *PTR)
Definition varatt.h:410

References detoast_attr(), and VARATT_IS_EXTENDED().

◆ pg_detoast_datum_copy()

varlena * pg_detoast_datum_copy ( varlena datum)
extern

Definition at line 1807 of file fmgr.c.

1808{
1809 if (VARATT_IS_EXTENDED(datum))
1810 return detoast_attr(datum);
1811 else
1812 {
1813 /* Make a modifiable copy of the varlena object */
1814 Size len = VARSIZE(datum);
1816
1817 memcpy(result, datum, len);
1818 return result;
1819 }
1820}
static Size VARSIZE(const void *PTR)
Definition varatt.h:298

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

Referenced by tuple_data_split_internal().

◆ pg_detoast_datum_packed()

varlena * pg_detoast_datum_packed ( varlena datum)
extern

Definition at line 1830 of file fmgr.c.

1831{
1832 if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
1833 return detoast_attr(datum);
1834 else
1835 return datum;
1836}
static bool VARATT_IS_EXTERNAL(const void *PTR)
Definition varatt.h:354
static bool VARATT_IS_COMPRESSED(const void *PTR)
Definition varatt.h:347

References detoast_attr(), VARATT_IS_COMPRESSED(), and VARATT_IS_EXTERNAL().

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

◆ pg_detoast_datum_slice()

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

Definition at line 1823 of file fmgr.c.

1824{
1825 /* Only get the specified portion from the toast rel */
1826 return detoast_attr_slice(datum, first, count);
1827}
varlena * detoast_attr_slice(varlena *attr, int32 sliceoffset, int32 slicelength)
Definition detoast.c:205

References detoast_attr_slice().

◆ ReceiveFunctionCall()

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

Definition at line 1698 of file fmgr.c.

1700{
1701 LOCAL_FCINFO(fcinfo, 3);
1702 Datum result;
1703
1704 if (buf == NULL && flinfo->fn_strict)
1705 return (Datum) 0; /* just return null result */
1706
1707 InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, NULL, NULL);
1708
1709 fcinfo->args[0].value = PointerGetDatum(buf);
1710 fcinfo->args[0].isnull = false;
1711 fcinfo->args[1].value = ObjectIdGetDatum(typioparam);
1712 fcinfo->args[1].isnull = false;
1713 fcinfo->args[2].value = Int32GetDatum(typmod);
1714 fcinfo->args[2].isnull = false;
1715
1716 result = FunctionCallInvoke(fcinfo);
1717
1718 /* Should get null result if and only if buf is NULL */
1719 if (buf == NULL)
1720 {
1721 if (!fcinfo->isnull)
1722 elog(ERROR, "receive function %u returned non-NULL",
1723 flinfo->fn_oid);
1724 }
1725 else
1726 {
1727 if (fcinfo->isnull)
1728 elog(ERROR, "receive function %u returned NULL",
1729 flinfo->fn_oid);
1730 }
1731
1732 return result;
1733}
static Datum PointerGetDatum(const void *X)
Definition postgres.h:342

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

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

◆ RestoreLibraryState()

void RestoreLibraryState ( char start_address)
extern

Definition at line 741 of file dfmgr.c.

742{
743 while (*start_address != '\0')
744 {
747 }
748}

References fb(), and internal_load_library().

Referenced by ParallelWorkerMain().

◆ SendFunctionCall()

◆ SerializeLibraryState()

void SerializeLibraryState ( Size  maxsize,
char start_address 
)
extern

Definition at line 719 of file dfmgr.c.

720{
722
723 for (file_scanner = file_list;
726 {
727 Size len;
728
729 len = strlcpy(start_address, file_scanner->filename, maxsize) + 1;
730 Assert(len < maxsize);
731 maxsize -= len;
733 }
734 start_address[0] = '\0';
735}

References Assert, fb(), file_list, len, DynamicFileList::next, and strlcpy().

Referenced by InitializeParallelDSM().

◆ set_fn_opclass_options()

void set_fn_opclass_options ( FmgrInfo flinfo,
bytea options 
)
extern

Definition at line 2036 of file fmgr.c.

2037{
2038 flinfo->fn_expr = (Node *) makeConst(BYTEAOID, -1, InvalidOid, -1,
2040 options == NULL, false);
2041}
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Definition makefuncs.c:350

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

Referenced by gincost_pattern(), and index_getprocinfo().

◆ StaticAssertDecl()

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

◆ substitute_path_macro()

char * substitute_path_macro ( const char str,
const char macro,
const char value 
)
extern

Definition at line 536 of file dfmgr.c.

537{
538 const char *sep_ptr;
539
540 Assert(str != NULL);
541 Assert(macro[0] == '$');
542
543 /* Currently, we only recognize $macro at the start of the string */
544 if (str[0] != '$')
545 return pstrdup(str);
546
548 sep_ptr = str + strlen(str);
549
550 if (strlen(macro) != sep_ptr - str ||
551 strncmp(str, macro, strlen(macro)) != 0)
554 errmsg("invalid macro name in path: %s",
555 str)));
556
557 return psprintf("%s%s", value, sep_ptr);
558}
static struct @177 value

References Assert, ereport, errcode(), errmsg, ERROR, fb(), first_dir_separator(), psprintf(), pstrdup(), str, and value.

Referenced by expand_dynamic_library_name(), find_in_path(), and get_extension_control_directories().

Variable Documentation

◆ Dynamic_library_path

PGDLLIMPORT char* Dynamic_library_path
extern

Definition at line 69 of file dfmgr.c.

Referenced by expand_dynamic_library_name().

◆ fmgr_hook

PGDLLIMPORT fmgr_hook_type fmgr_hook
extern

Definition at line 42 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 41 of file fmgr.c.

Referenced by sepgsql_init_client_label().