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

Go to the source code of this file.

Data Structures

struct  FmgrInfo
 
struct  FunctionCallInfoBaseData
 
struct  Pg_finfo_record
 
struct  Pg_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((struct varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_COPY(datum)    pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
 
#define PG_DETOAST_DATUM_SLICE(datum, f, c)
 
#define PG_DETOAST_DATUM_PACKED(datum)    pg_detoast_datum_packed((struct varlena *) DatumGetPointer(datum))
 
#define PG_FREE_IF_COPY(ptr, n)
 
#define PG_GETARG_DATUM(n)   (fcinfo->args[n].value)
 
#define PG_GETARG_INT32(n)   DatumGetInt32(PG_GETARG_DATUM(n))
 
#define PG_GETARG_UINT32(n)   DatumGetUInt32(PG_GETARG_DATUM(n))
 
#define PG_GETARG_INT16(n)   DatumGetInt16(PG_GETARG_DATUM(n))
 
#define PG_GETARG_UINT16(n)   DatumGetUInt16(PG_GETARG_DATUM(n))
 
#define PG_GETARG_CHAR(n)   DatumGetChar(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BOOL(n)   DatumGetBool(PG_GETARG_DATUM(n))
 
#define PG_GETARG_OID(n)   DatumGetObjectId(PG_GETARG_DATUM(n))
 
#define PG_GETARG_POINTER(n)   DatumGetPointer(PG_GETARG_DATUM(n))
 
#define PG_GETARG_CSTRING(n)   DatumGetCString(PG_GETARG_DATUM(n))
 
#define PG_GETARG_NAME(n)   DatumGetName(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TRANSACTIONID(n)   DatumGetTransactionId(PG_GETARG_DATUM(n))
 
#define PG_GETARG_FLOAT4(n)   DatumGetFloat4(PG_GETARG_DATUM(n))
 
#define PG_GETARG_FLOAT8(n)   DatumGetFloat8(PG_GETARG_DATUM(n))
 
#define PG_GETARG_INT64(n)   DatumGetInt64(PG_GETARG_DATUM(n))
 
#define PG_GETARG_RAW_VARLENA_P(n)   ((struct varlena *) PG_GETARG_POINTER(n))
 
#define PG_GETARG_VARLENA_P(n)   PG_DETOAST_DATUM(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARLENA_PP(n)   PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(n))
 
#define DatumGetByteaPP(X)   ((bytea *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetTextPP(X)   ((text *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetBpCharPP(X)   ((BpChar *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetVarCharPP(X)   ((VarChar *) PG_DETOAST_DATUM_PACKED(X))
 
#define DatumGetHeapTupleHeader(X)   ((HeapTupleHeader) PG_DETOAST_DATUM(X))
 
#define DatumGetByteaPCopy(X)   ((bytea *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetTextPCopy(X)   ((text *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetBpCharPCopy(X)   ((BpChar *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetVarCharPCopy(X)   ((VarChar *) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetHeapTupleHeaderCopy(X)   ((HeapTupleHeader) PG_DETOAST_DATUM_COPY(X))
 
#define DatumGetByteaPSlice(X, m, n)   ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetTextPSlice(X, m, n)   ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetBpCharPSlice(X, m, n)   ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define DatumGetVarCharPSlice(X, m, n)   ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 
#define PG_GETARG_BYTEA_PP(n)   DatumGetByteaPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_PP(n)   DatumGetTextPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_PP(n)   DatumGetBpCharPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_PP(n)   DatumGetVarCharPP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_HEAPTUPLEHEADER(n)   DatumGetHeapTupleHeader(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BYTEA_P_COPY(n)   DatumGetByteaPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_P_COPY(n)   DatumGetTextPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_P_COPY(n)   DatumGetBpCharPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_P_COPY(n)   DatumGetVarCharPCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_HEAPTUPLEHEADER_COPY(n)   DatumGetHeapTupleHeaderCopy(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BYTEA_P_SLICE(n, a, b)   DatumGetByteaPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_TEXT_P_SLICE(n, a, b)   DatumGetTextPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_BPCHAR_P_SLICE(n, a, b)   DatumGetBpCharPSlice(PG_GETARG_DATUM(n),a,b)
 
#define PG_GETARG_VARCHAR_P_SLICE(n, a, b)   DatumGetVarCharPSlice(PG_GETARG_DATUM(n),a,b)
 
#define DatumGetByteaP(X)   ((bytea *) PG_DETOAST_DATUM(X))
 
#define DatumGetTextP(X)   ((text *) PG_DETOAST_DATUM(X))
 
#define DatumGetBpCharP(X)   ((BpChar *) PG_DETOAST_DATUM(X))
 
#define DatumGetVarCharP(X)   ((VarChar *) PG_DETOAST_DATUM(X))
 
#define PG_GETARG_BYTEA_P(n)   DatumGetByteaP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_TEXT_P(n)   DatumGetTextP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_BPCHAR_P(n)   DatumGetBpCharP(PG_GETARG_DATUM(n))
 
#define PG_GETARG_VARCHAR_P(n)   DatumGetVarCharP(PG_GETARG_DATUM(n))
 
#define PG_HAS_OPCLASS_OPTIONS()   has_fn_opclass_options(fcinfo->flinfo)
 
#define PG_GET_OPCLASS_OPTIONS()   get_fn_opclass_options(fcinfo->flinfo)
 
#define PG_RETURN_NULL()    do { fcinfo->isnull = true; return (Datum) 0; } while (0)
 
#define PG_RETURN_VOID()   return (Datum) 0
 
#define PG_RETURN_DATUM(x)   return (x)
 
#define PG_RETURN_INT32(x)   return Int32GetDatum(x)
 
#define PG_RETURN_UINT32(x)   return UInt32GetDatum(x)
 
#define PG_RETURN_INT16(x)   return Int16GetDatum(x)
 
#define PG_RETURN_UINT16(x)   return UInt16GetDatum(x)
 
#define PG_RETURN_CHAR(x)   return CharGetDatum(x)
 
#define PG_RETURN_BOOL(x)   return BoolGetDatum(x)
 
#define PG_RETURN_OID(x)   return ObjectIdGetDatum(x)
 
#define PG_RETURN_POINTER(x)   return PointerGetDatum(x)
 
#define PG_RETURN_CSTRING(x)   return CStringGetDatum(x)
 
#define PG_RETURN_NAME(x)   return NameGetDatum(x)
 
#define PG_RETURN_TRANSACTIONID(x)   return TransactionIdGetDatum(x)
 
#define PG_RETURN_FLOAT4(x)   return Float4GetDatum(x)
 
#define PG_RETURN_FLOAT8(x)   return Float8GetDatum(x)
 
#define PG_RETURN_INT64(x)   return Int64GetDatum(x)
 
#define PG_RETURN_UINT64(x)   return UInt64GetDatum(x)
 
#define PG_RETURN_BYTEA_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_TEXT_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_BPCHAR_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_VARCHAR_P(x)   PG_RETURN_POINTER(x)
 
#define PG_RETURN_HEAPTUPLEHEADER(x)   return HeapTupleHeaderGetDatum(x)
 
#define PG_FUNCTION_INFO_V1(funcname)
 
#define PG_MODULE_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)
 
struct varlenapg_detoast_datum (struct varlena *datum)
 
struct varlenapg_detoast_datum_copy (struct varlena *datum)
 
struct varlenapg_detoast_datum_slice (struct varlena *datum, int32 first, int32 count)
 
struct varlenapg_detoast_datum_packed (struct varlena *datum)
 
PGDLLEXPORT void _PG_init (void)
 
 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)
 
char * OutputFunctionCall (FmgrInfo *flinfo, Datum val)
 
char * OidOutputFunctionCall (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)
 
char * substitute_path_macro (const char *str, const char *macro, const char *value)
 
char * find_in_path (const char *basename, const char *path, const char *path_param, const char *macro, const char *macro_val)
 
void * load_external_function (const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
 
void * lookup_external_function (void *filehandle, const char *funcname)
 
void load_file (const char *filename, bool restricted)
 
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 char * Dynamic_library_path
 
PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook
 
PGDLLIMPORT fmgr_hook_type fmgr_hook
 

Macro Definition Documentation

◆ AGG_CONTEXT_AGGREGATE

#define AGG_CONTEXT_AGGREGATE   1 /* regular aggregate */

Definition at line 812 of file fmgr.h.

◆ AGG_CONTEXT_WINDOW

#define AGG_CONTEXT_WINDOW   2 /* window function */

Definition at line 813 of file fmgr.h.

◆ DatumGetBpCharP

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

Definition at line 333 of file fmgr.h.

◆ DatumGetBpCharPCopy

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

Definition at line 299 of file fmgr.h.

◆ DatumGetBpCharPP

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

Definition at line 293 of file fmgr.h.

◆ DatumGetBpCharPSlice

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

Definition at line 305 of file fmgr.h.

◆ DatumGetByteaP

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

Definition at line 331 of file fmgr.h.

◆ DatumGetByteaPCopy

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

Definition at line 297 of file fmgr.h.

◆ DatumGetByteaPP

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

Definition at line 291 of file fmgr.h.

◆ DatumGetByteaPSlice

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

Definition at line 303 of file fmgr.h.

◆ DatumGetHeapTupleHeader

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

Definition at line 295 of file fmgr.h.

◆ DatumGetHeapTupleHeaderCopy

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

Definition at line 301 of file fmgr.h.

◆ DatumGetTextP

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

Definition at line 332 of file fmgr.h.

◆ DatumGetTextPCopy

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

Definition at line 298 of file fmgr.h.

◆ DatumGetTextPP

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

Definition at line 292 of file fmgr.h.

◆ DatumGetTextPSlice

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

Definition at line 304 of file fmgr.h.

◆ DatumGetVarCharP

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

Definition at line 334 of file fmgr.h.

◆ DatumGetVarCharPCopy

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

Definition at line 300 of file fmgr.h.

◆ DatumGetVarCharPP

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

Definition at line 294 of file fmgr.h.

◆ DatumGetVarCharPSlice

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

Definition at line 306 of file fmgr.h.

◆ DirectFunctionCall1

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

Definition at line 682 of file fmgr.h.

◆ DirectFunctionCall2

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

Definition at line 684 of file fmgr.h.

◆ DirectFunctionCall3

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

Definition at line 686 of file fmgr.h.

◆ DirectFunctionCall4

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

Definition at line 688 of file fmgr.h.

◆ DirectFunctionCall5

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

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

◆ FunctionCall1

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

Definition at line 700 of file fmgr.h.

◆ FunctionCall2

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

Definition at line 702 of file fmgr.h.

◆ FunctionCall3

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

Definition at line 704 of file fmgr.h.

◆ FunctionCall4

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

Definition at line 706 of file fmgr.h.

◆ FunctionCall5

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

Definition at line 708 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 710 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 712 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 714 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 716 of file fmgr.h.

◆ FunctionCallInvoke

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

Definition at line 172 of file fmgr.h.

◆ InitFunctionCallInfoData

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

Definition at line 150 of file fmgr.h.

◆ LOCAL_FCINFO

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

Definition at line 110 of file fmgr.h.

◆ OidFunctionCall0

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

Definition at line 718 of file fmgr.h.

◆ OidFunctionCall1

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

Definition at line 720 of file fmgr.h.

◆ OidFunctionCall2

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

Definition at line 722 of file fmgr.h.

◆ OidFunctionCall3

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

Definition at line 724 of file fmgr.h.

◆ OidFunctionCall4

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

Definition at line 726 of file fmgr.h.

◆ OidFunctionCall5

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

Definition at line 728 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 730 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 732 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 734 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 736 of file fmgr.h.

◆ PG_ARGISNULL

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

Definition at line 209 of file fmgr.h.

◆ PG_DETOAST_DATUM

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

Definition at line 240 of file fmgr.h.

◆ PG_DETOAST_DATUM_COPY

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

Definition at line 242 of file fmgr.h.

◆ PG_DETOAST_DATUM_PACKED

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

Definition at line 248 of file fmgr.h.

◆ PG_DETOAST_DATUM_SLICE

#define PG_DETOAST_DATUM_SLICE (   datum,
  f,
  c 
)
Value:
(int32) (f), (int32) (c))
int32_t int32
Definition: c.h:537
struct varlena * pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count)
Definition: fmgr.c:1822
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:322
char * c
Definition: c.h:695

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:276

Definition at line 260 of file fmgr.h.

◆ PG_FUNCTION_ARGS

#define PG_FUNCTION_ARGS   FunctionCallInfo fcinfo

Definition at line 193 of file fmgr.h.

◆ PG_FUNCTION_INFO_V1

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

Definition at line 415 of file fmgr.h.

◆ PG_GET_COLLATION

#define PG_GET_COLLATION ( )    (fcinfo->fncollation)

Definition at line 198 of file fmgr.h.

◆ PG_GET_OPCLASS_OPTIONS

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

Definition at line 342 of file fmgr.h.

◆ PG_GETARG_BOOL

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

Definition at line 274 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P

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

Definition at line 337 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P_COPY

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

Definition at line 316 of file fmgr.h.

◆ PG_GETARG_BPCHAR_P_SLICE

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

Definition at line 322 of file fmgr.h.

◆ PG_GETARG_BPCHAR_PP

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

Definition at line 310 of file fmgr.h.

◆ PG_GETARG_BYTEA_P

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

Definition at line 335 of file fmgr.h.

◆ PG_GETARG_BYTEA_P_COPY

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

Definition at line 314 of file fmgr.h.

◆ PG_GETARG_BYTEA_P_SLICE

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

Definition at line 320 of file fmgr.h.

◆ PG_GETARG_BYTEA_PP

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

Definition at line 308 of file fmgr.h.

◆ PG_GETARG_CHAR

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

Definition at line 273 of file fmgr.h.

◆ PG_GETARG_CSTRING

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

Definition at line 277 of file fmgr.h.

◆ PG_GETARG_DATUM

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

Definition at line 268 of file fmgr.h.

◆ PG_GETARG_FLOAT4

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

Definition at line 281 of file fmgr.h.

◆ PG_GETARG_FLOAT8

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

Definition at line 282 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER

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

Definition at line 312 of file fmgr.h.

◆ PG_GETARG_HEAPTUPLEHEADER_COPY

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

Definition at line 318 of file fmgr.h.

◆ PG_GETARG_INT16

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

Definition at line 271 of file fmgr.h.

◆ PG_GETARG_INT32

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

Definition at line 269 of file fmgr.h.

◆ PG_GETARG_INT64

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

Definition at line 283 of file fmgr.h.

◆ PG_GETARG_NAME

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

Definition at line 278 of file fmgr.h.

◆ PG_GETARG_OID

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

Definition at line 275 of file fmgr.h.

◆ PG_GETARG_POINTER

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

Definition at line 276 of file fmgr.h.

◆ PG_GETARG_RAW_VARLENA_P

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

Definition at line 285 of file fmgr.h.

◆ PG_GETARG_TEXT_P

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

Definition at line 336 of file fmgr.h.

◆ PG_GETARG_TEXT_P_COPY

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

Definition at line 315 of file fmgr.h.

◆ PG_GETARG_TEXT_P_SLICE

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

Definition at line 321 of file fmgr.h.

◆ PG_GETARG_TEXT_PP

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

Definition at line 309 of file fmgr.h.

◆ PG_GETARG_TRANSACTIONID

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

Definition at line 279 of file fmgr.h.

◆ PG_GETARG_UINT16

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

Definition at line 272 of file fmgr.h.

◆ PG_GETARG_UINT32

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

Definition at line 270 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P

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

Definition at line 338 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P_COPY

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

Definition at line 317 of file fmgr.h.

◆ PG_GETARG_VARCHAR_P_SLICE

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

Definition at line 323 of file fmgr.h.

◆ PG_GETARG_VARCHAR_PP

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

Definition at line 311 of file fmgr.h.

◆ PG_GETARG_VARLENA_P

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

Definition at line 287 of file fmgr.h.

◆ PG_GETARG_VARLENA_PP

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

Definition at line 289 of file fmgr.h.

◆ PG_HAS_OPCLASS_OPTIONS

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

Definition at line 341 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME

#define PG_MAGIC_FUNCTION_NAME   Pg_magic_func

Definition at line 517 of file fmgr.h.

◆ PG_MAGIC_FUNCTION_NAME_STRING

#define PG_MAGIC_FUNCTION_NAME_STRING   "Pg_magic_func"

Definition at line 518 of file fmgr.h.

◆ PG_MODULE_ABI_DATA

#define PG_MODULE_ABI_DATA
Value:
{ \
PG_VERSION_NUM / 100, \
FUNC_MAX_ARGS, \
INDEX_MAX_KEYS, \
NAMEDATALEN, \
FLOAT8PASSBYVAL, \
FMGR_ABI_EXTRA, \
}

Definition at line 487 of file fmgr.h.

◆ PG_MODULE_MAGIC

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

Definition at line 520 of file fmgr.h.

◆ PG_MODULE_MAGIC_DATA

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

Definition at line 501 of file fmgr.h.

◆ PG_MODULE_MAGIC_EXT

#define PG_MODULE_MAGIC_EXT (   ...)
Value:
const Pg_magic_struct * \
PG_MAGIC_FUNCTION_NAME(void) \
{ \
static const Pg_magic_struct Pg_magic_data = \
PG_MODULE_MAGIC_DATA(__VA_ARGS__); \
return &Pg_magic_data; \
} \
extern int no_such_variable

Definition at line 538 of file fmgr.h.

◆ PG_NARGS

#define PG_NARGS ( )    (fcinfo->nargs)

Definition at line 203 of file fmgr.h.

◆ PG_RETURN_BOOL

#define PG_RETURN_BOOL (   x)    return BoolGetDatum(x)

Definition at line 359 of file fmgr.h.

◆ PG_RETURN_BPCHAR_P

#define PG_RETURN_BPCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 373 of file fmgr.h.

◆ PG_RETURN_BYTEA_P

#define PG_RETURN_BYTEA_P (   x)    PG_RETURN_POINTER(x)

Definition at line 371 of file fmgr.h.

◆ PG_RETURN_CHAR

#define PG_RETURN_CHAR (   x)    return CharGetDatum(x)

Definition at line 358 of file fmgr.h.

◆ PG_RETURN_CSTRING

#define PG_RETURN_CSTRING (   x)    return CStringGetDatum(x)

Definition at line 362 of file fmgr.h.

◆ PG_RETURN_DATUM

#define PG_RETURN_DATUM (   x)    return (x)

Definition at line 353 of file fmgr.h.

◆ PG_RETURN_FLOAT4

#define PG_RETURN_FLOAT4 (   x)    return Float4GetDatum(x)

Definition at line 366 of file fmgr.h.

◆ PG_RETURN_FLOAT8

#define PG_RETURN_FLOAT8 (   x)    return Float8GetDatum(x)

Definition at line 367 of file fmgr.h.

◆ PG_RETURN_HEAPTUPLEHEADER

#define PG_RETURN_HEAPTUPLEHEADER (   x)    return HeapTupleHeaderGetDatum(x)

Definition at line 375 of file fmgr.h.

◆ PG_RETURN_INT16

#define PG_RETURN_INT16 (   x)    return Int16GetDatum(x)

Definition at line 356 of file fmgr.h.

◆ PG_RETURN_INT32

#define PG_RETURN_INT32 (   x)    return Int32GetDatum(x)

Definition at line 354 of file fmgr.h.

◆ PG_RETURN_INT64

#define PG_RETURN_INT64 (   x)    return Int64GetDatum(x)

Definition at line 368 of file fmgr.h.

◆ PG_RETURN_NAME

#define PG_RETURN_NAME (   x)    return NameGetDatum(x)

Definition at line 363 of file fmgr.h.

◆ PG_RETURN_NULL

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

Definition at line 345 of file fmgr.h.

◆ PG_RETURN_OID

#define PG_RETURN_OID (   x)    return ObjectIdGetDatum(x)

Definition at line 360 of file fmgr.h.

◆ PG_RETURN_POINTER

#define PG_RETURN_POINTER (   x)    return PointerGetDatum(x)

Definition at line 361 of file fmgr.h.

◆ PG_RETURN_TEXT_P

#define PG_RETURN_TEXT_P (   x)    PG_RETURN_POINTER(x)

Definition at line 372 of file fmgr.h.

◆ PG_RETURN_TRANSACTIONID

#define PG_RETURN_TRANSACTIONID (   x)    return TransactionIdGetDatum(x)

Definition at line 364 of file fmgr.h.

◆ PG_RETURN_UINT16

#define PG_RETURN_UINT16 (   x)    return UInt16GetDatum(x)

Definition at line 357 of file fmgr.h.

◆ PG_RETURN_UINT32

#define PG_RETURN_UINT32 (   x)    return UInt32GetDatum(x)

Definition at line 355 of file fmgr.h.

◆ PG_RETURN_UINT64

#define PG_RETURN_UINT64 (   x)    return UInt64GetDatum(x)

Definition at line 369 of file fmgr.h.

◆ PG_RETURN_VARCHAR_P

#define PG_RETURN_VARCHAR_P (   x)    PG_RETURN_POINTER(x)

Definition at line 374 of file fmgr.h.

◆ PG_RETURN_VOID

#define PG_RETURN_VOID ( )    return (Datum) 0

Definition at line 349 of file fmgr.h.

◆ SizeForFunctionCallInfo

#define SizeForFunctionCallInfo (   nargs)
Value:

Definition at line 102 of file fmgr.h.

Typedef Documentation

◆ Aggref

typedef struct Aggref Aggref

Definition at line 23 of file fmgr.h.

◆ DynamicFileList

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

◆ FmgrHookEventType

◆ FmgrInfo

typedef struct FmgrInfo 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 840 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 401 of file fmgr.h.

◆ PGFunction

typedef Datum(* PGFunction) (FunctionCallInfo fcinfo)

Definition at line 40 of file fmgr.h.

◆ PGModuleMagicFunction

typedef const Pg_magic_struct *(* PGModuleMagicFunction) (void)

Definition at line 515 of file fmgr.h.

◆ StringInfo

typedef struct StringInfoData* StringInfo

Definition at line 29 of file fmgr.h.

Enumeration Type Documentation

◆ FmgrHookEventType

Enumerator
FHET_START 
FHET_END 
FHET_ABORT 

Definition at line 833 of file fmgr.h.

834{
836 FHET_END,
FmgrHookEventType
Definition: fmgr.h:834
@ FHET_END
Definition: fmgr.h:836
@ FHET_ABORT
Definition: fmgr.h:837
@ FHET_START
Definition: fmgr.h:835

Function Documentation

◆ _PG_init()

PGDLLEXPORT void _PG_init ( void  )

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:223
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:5148
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:5035
#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, AssertVariableIsOfType, 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(), DEFAULT_BLOOM_BITS, DEFAULT_BLOOM_LENGTH, DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), delay_execution_planner(), dummy_object_relabel(), EAN13_index, EAN13_range, elog, EnableQueryId(), HASHCTL::entrysize, ereport, errcode(), errdetail(), errmsg(), ERROR, 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, 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, hstoreCheckKeyLen_p, hstoreCheckValLen, hstoreCheckValLen_p, hstorePairs, hstorePairs_p, hstoreUniquePairs, hstoreUniquePairs_p, hstoreUpgrade, hstoreUpgrade_p, i, INDEX_MAX_KEYS, inj_stats_enabled, injection_shmem_request(), injection_shmem_startup(), Int32GetDatum(), ISBN_index, ISBN_range, ISMN_index, ISMN_range, ISN_DEBUG, ISSN_index, ISSN_range, IsUnderPostmaster, HASHCTL::keysize, ldap_password_hook, load_external_function(), LOG, loglevel_options, MarkGUCPrefixReserved(), MAX_BLOOM_BITS, MAX_BLOOM_LENGTH, MemoryContextStrdup(), min_password_length, next_exec_check_perms_hook, next_object_access_hook, next_object_access_hook_str, next_ProcessUtility_hook, object_access_hook, object_access_hook_str, relopt_parse_elt::offset, openssl_tls_init_hook, relopt_parse_elt::optname, relopt_parse_elt::opttype, original_client_auth_hook, overexplain_debug_handler(), overexplain_per_node_hook(), overexplain_per_plan_hook(), overexplain_range_table_handler(), pg_bindtextdomain(), PGC_POSTMASTER, PGC_SIGHUP, PGC_SUSET, PGC_USERSET, pgfdw_application_name, pgss_ExecutorEnd(), pgss_ExecutorFinish(), pgss_ExecutorRun(), pgss_ExecutorStart(), pgss_max, pgss_planner(), pgss_post_parse_analyze(), pgss_ProcessUtility(), pgss_save, pgss_shmem_request(), pgss_shmem_startup(), pgss_track, pgss_track_planning, PGSS_TRACK_TOP, pgss_track_utility, pgstat_register_inj(), pgstat_register_inj_fixed(), 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_impl(), PLy_elog_impl_p, PLy_initialize(), PLyObject_AsString, PLyObject_AsString_p, PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_p, post_parse_analyze_hook, post_planning_lock_id, PQWalReceiverFunctions, prev_check_password_hook, prev_ExecutorEnd, prev_ExecutorFinish, prev_ExecutorRun, prev_ExecutorStart, prev_explain_per_node_hook, prev_explain_per_plan_hook, prev_planner_hook, prev_post_parse_analyze_hook, prev_ProcessUtility, prev_shmem_request_hook, prev_shmem_startup_hook, process_shared_preload_libraries_in_progress, ProcessUtility_hook, register_label_provider(), RegisterBackgroundWorker(), RegisterCustomRmgr(), 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_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 
)

Definition at line 4613 of file nodeAgg.c.

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

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

Referenced by array_agg_array_combine(), array_agg_array_deserialize(), array_agg_array_finalfn(), array_agg_array_serialize(), array_agg_array_transfn(), array_agg_combine(), array_agg_deserialize(), array_agg_finalfn(), array_agg_serialize(), array_agg_transfn(), bytea_string_agg_finalfn(), 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)

Definition at line 4657 of file nodeAgg.c.

4658{
4659 if (fcinfo->context && IsA(fcinfo->context, AggState))
4660 {
4661 AggState *aggstate = (AggState *) fcinfo->context;
4662 AggStatePerAgg curperagg;
4663 AggStatePerTrans curpertrans;
4664
4665 /* check curperagg (valid when in a final function) */
4666 curperagg = aggstate->curperagg;
4667
4668 if (curperagg)
4669 return curperagg->aggref;
4670
4671 /* check curpertrans (valid when in a transition function) */
4672 curpertrans = aggstate->curpertrans;
4673
4674 if (curpertrans)
4675 return curpertrans->aggref;
4676 }
4677 return NULL;
4678}
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:81
Aggref * aggref
Definition: nodeAgg.h:44
AggStatePerTrans curpertrans
Definition: execnodes.h:2553
AggStatePerAgg curperagg
Definition: execnodes.h:2551

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

Referenced by ordered_set_startup().

◆ AggGetTempMemoryContext()

MemoryContext AggGetTempMemoryContext ( FunctionCallInfo  fcinfo)

Definition at line 4691 of file nodeAgg.c.

4692{
4693 if (fcinfo->context && IsA(fcinfo->context, AggState))
4694 {
4695 AggState *aggstate = (AggState *) fcinfo->context;
4696
4697 return aggstate->tmpcontext->ecxt_per_tuple_memory;
4698 }
4699 return NULL;
4700}
ExprContext * tmpcontext
Definition: execnodes.h:2548

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

◆ AggRegisterCallback()

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

Definition at line 4756 of file nodeAgg.c.

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

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

Referenced by ordered_set_startup().

◆ AggStateIsShared()

bool AggStateIsShared ( FunctionCallInfo  fcinfo)

Definition at line 4717 of file nodeAgg.c.

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

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

Referenced by ordered_set_startup().

◆ CallerFInfoFunctionCall1()

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

Definition at line 1066 of file fmgr.c.

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

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

◆ CallerFInfoFunctionCall2()

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

Definition at line 1086 of file fmgr.c.

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

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

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 
)

Definition at line 2110 of file fmgr.c.

2111{
2112 HeapTuple procTup;
2113 HeapTuple langTup;
2114 Form_pg_proc procStruct;
2115 Form_pg_language langStruct;
2116 AclResult aclresult;
2117
2118 /*
2119 * Get the function's pg_proc entry. Throw a user-facing error for bad
2120 * OID, because validators can be called with user-specified OIDs.
2121 */
2122 procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(functionOid));
2123 if (!HeapTupleIsValid(procTup))
2124 ereport(ERROR,
2125 (errcode(ERRCODE_UNDEFINED_FUNCTION),
2126 errmsg("function with OID %u does not exist", functionOid)));
2127 procStruct = (Form_pg_proc) GETSTRUCT(procTup);
2128
2129 /*
2130 * Fetch pg_language entry to know if this is the correct validation
2131 * function for that pg_proc entry.
2132 */
2133 langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(procStruct->prolang));
2134 if (!HeapTupleIsValid(langTup))
2135 elog(ERROR, "cache lookup failed for language %u", procStruct->prolang);
2136 langStruct = (Form_pg_language) GETSTRUCT(langTup);
2137
2138 if (langStruct->lanvalidator != validatorOid)
2139 ereport(ERROR,
2140 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
2141 errmsg("language validation function %u called for language %u instead of %u",
2142 validatorOid, procStruct->prolang,
2143 langStruct->lanvalidator)));
2144
2145 /* first validate that we have permissions to use the language */
2146 aclresult = object_aclcheck(LanguageRelationId, procStruct->prolang, GetUserId(),
2147 ACL_USAGE);
2148 if (aclresult != ACLCHECK_OK)
2150 NameStr(langStruct->lanname));
2151
2152 /*
2153 * Check whether we are allowed to execute the function itself. If we can
2154 * execute it, there should be no possible side-effect of
2155 * compiling/validation that execution can't have.
2156 */
2157 aclresult = object_aclcheck(ProcedureRelationId, functionOid, GetUserId(), ACL_EXECUTE);
2158 if (aclresult != ACLCHECK_OK)
2159 aclcheck_error(aclresult, OBJECT_FUNCTION, NameStr(procStruct->proname));
2160
2161 ReleaseSysCache(procTup);
2162 ReleaseSysCache(langTup);
2163
2164 return true;
2165}
AclResult
Definition: acl.h:182
@ ACLCHECK_OK
Definition: acl.h:183
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition: aclchk.c:2652
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
Definition: aclchk.c:3834
#define NameStr(name)
Definition: c.h:754
int errcode(int sqlerrcode)
Definition: elog.c:863
int errmsg(const char *fmt,...)
Definition: elog.c:1080
#define ereport(elevel,...)
Definition: elog.h:150
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
static void * GETSTRUCT(const HeapTupleData *tuple)
Definition: htup_details.h:728
Oid GetUserId(void)
Definition: miscinit.c:469
#define ACL_USAGE
Definition: parsenodes.h:84
@ OBJECT_LANGUAGE
Definition: parsenodes.h:2346
@ OBJECT_FUNCTION
Definition: parsenodes.h:2344
#define ACL_EXECUTE
Definition: parsenodes.h:83
FormData_pg_language * Form_pg_language
Definition: pg_language.h:65
FormData_pg_proc * Form_pg_proc
Definition: pg_proc.h:136
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:262
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:264
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:220

References ACL_EXECUTE, ACL_USAGE, aclcheck_error(), ACLCHECK_OK, elog, ereport, errcode(), errmsg(), ERROR, 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 
)

Definition at line 793 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

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

◆ DirectFunctionCall2Coll()

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

Definition at line 813 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by 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 
)

Definition at line 835 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by execute_extension_script().

◆ DirectFunctionCall4Coll()

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

Definition at line 860 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by execute_extension_script().

◆ DirectFunctionCall5Coll()

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

Definition at line 887 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

Referenced by neqjoinsel().

◆ DirectFunctionCall6Coll()

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

Definition at line 916 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall7Coll()

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

Definition at line 948 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall8Coll()

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

Definition at line 982 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectFunctionCall9Coll()

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

Definition at line 1018 of file fmgr.c.

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

References elog, ERROR, InitFunctionCallInfoData, and LOCAL_FCINFO.

◆ DirectInputFunctionCallSafe()

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

Definition at line 1640 of file fmgr.c.

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

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

Referenced by executeItemOptUnwrapTarget(), jsonb_in_scalar(), 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  )

Definition at line 702 of file dfmgr.c.

703{
704 DynamicFileList *file_scanner;
705 Size size = 1;
706
707 for (file_scanner = file_list;
708 file_scanner != NULL;
709 file_scanner = file_scanner->next)
710 size = add_size(size, strlen(file_scanner->filename) + 1);
711
712 return size;
713}
size_t Size
Definition: c.h:613
static DynamicFileList * file_list
Definition: dfmgr.c:59
Size add_size(Size s1, Size s2)
Definition: shmem.c:495
char filename[FLEXIBLE_ARRAY_MEMBER]
Definition: dfmgr.c:56
DynamicFileList * next
Definition: dfmgr.c:48

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

Referenced by InitializeParallelDSM().

◆ fetch_finfo_record()

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

Definition at line 456 of file fmgr.c.

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

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

Referenced by fmgr_c_validator(), and fmgr_info_C_lang().

◆ find_in_path()

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

Definition at line 574 of file dfmgr.c.

576{
577 const char *p;
578 size_t baselen;
579
580 Assert(basename != NULL);
581 Assert(first_dir_separator(basename) == NULL);
582 Assert(path != NULL);
583 Assert(path_param != 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
602 piece = first_path_var_separator(p);
603 if (piece == p)
605 (errcode(ERRCODE_INVALID_NAME),
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
616 mangled = substitute_path_macro(piece, macro, macro_val);
617 pfree(piece);
618
619 canonicalize_path(mangled);
620
621 /* only absolute paths */
622 if (!is_absolute_path(mangled))
624 (errcode(ERRCODE_INVALID_NAME),
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}
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:500
Assert(PointerIsAligned(start, uint64))
void * palloc(Size size)
Definition: mcxt.c:1365
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, 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)

Definition at line 664 of file dfmgr.c.

665{
666 static HTAB *rendezvousHash = NULL;
667
668 rendezvousHashEntry *hentry;
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
676 ctl.keysize = NAMEDATALEN;
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 */
685 hentry = (rendezvousHashEntry *) hash_search(rendezvousHash,
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:952
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
Definition: dynahash.c:358
#define HASH_STRINGS
Definition: hsearch.h:96
@ HASH_ENTER
Definition: hsearch.h:114
#define HASH_ELEM
Definition: hsearch.h:95
#define NAMEDATALEN
tree ctl
Definition: radixtree.h:1838
Definition: dynahash.c:222
void * varValue
Definition: dfmgr.c:38

References ctl, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASH_STRINGS, NAMEDATALEN, and rendezvousHashEntry::varValue.

Referenced by _PG_init().

◆ fmgr_info()

void fmgr_info ( Oid  functionId,
FmgrInfo finfo 
)

Definition at line 128 of file fmgr.c.

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

References CurrentMemoryContext, 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(), 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(), 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(), text_format(), TupleDescGetAttInMetadata(), and var_eq_const().

◆ fmgr_info_copy()

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

◆ fmgr_info_cxt()

◆ fmgr_internal_function()

Oid fmgr_internal_function ( const char *  proname)

Definition at line 596 of file fmgr.c.

597{
599
600 if (fbp == NULL)
601 return InvalidOid;
602 return fbp->foid;
603}
static const FmgrBuiltin * fmgr_lookupByName(const char *name)
Definition: fmgr.c:102
NameData proname
Definition: pg_proc.h:35
Oid foid
Definition: fmgrtab.h:27

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

Referenced by fmgr_internal_validator().

◆ fmgr_symbol()

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

Definition at line 282 of file fmgr.c.

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

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

Referenced by llvm_function_reference().

◆ FunctionCall0Coll()

Datum FunctionCall0Coll ( FmgrInfo flinfo,
Oid  collation 
)

Definition at line 1113 of file fmgr.c.

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

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

Referenced by OidFunctionCall0Coll().

◆ FunctionCall1Coll()

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

Definition at line 1130 of file fmgr.c.

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

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

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

◆ FunctionCall2Coll()

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

Definition at line 1150 of file fmgr.c.

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

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

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(), ExecEvalPreOrderedDistinctSingle(), execTuplesUnequal(), genericPickSplit(), get_distance(), get_partition_for_tuple(), get_position(), get_stats_slot_range(), ginCompareEntries(), gistMakeUnionItVec(), gistMakeUnionKey(), gistUserPicksplit(), has_matching_range(), hash_multirange_extended(), hash_range_extended(), HeapKeyTest(), ineq_histogram_selectivity(), make_greater_string(), mcv_get_match_bitmap(), merge_list_bounds(), merge_overlapping_ranges(), mode_final(), multirange_elem_bsearch_comparison(), OidFunctionCall2Coll(), partition_list_bsearch(), partition_rbound_cmp(), partition_rbound_datum_cmp(), process_ordered_aggregate_single(), qsort_partition_list_value_cmp(), range_cmp_bound_values(), range_cmp_bounds(), range_contains_elem_internal(), range_contains_value(), ri_CompareWithCast(), satisfies_hash_partition(), spgdoinsert(), spgGetCache(), spgInnerTest(), spgLeafTest(), and tuples_equal().

◆ FunctionCall3Coll()

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

Definition at line 1172 of file fmgr.c.

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

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

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

◆ FunctionCall4Coll()

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

Definition at line 1197 of file fmgr.c.

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

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

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

◆ FunctionCall5Coll()

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

Definition at line 1224 of file fmgr.c.

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

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

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

◆ FunctionCall6Coll()

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

Definition at line 1253 of file fmgr.c.

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

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

Referenced by OidFunctionCall6Coll().

◆ FunctionCall7Coll()

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

Definition at line 1285 of file fmgr.c.

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

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

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

◆ FunctionCall8Coll()

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

Definition at line 1319 of file fmgr.c.

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

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

Referenced by directBoolConsistentFn(), and OidFunctionCall8Coll().

◆ FunctionCall9Coll()

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

Definition at line 1355 of file fmgr.c.

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

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

Referenced by OidFunctionCall9Coll().

◆ get_call_expr_arg_stable()

bool get_call_expr_arg_stable ( Node expr,
int  argnum 
)

Definition at line 1959 of file fmgr.c.

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

References arg, generate_unaccent_rules::args, 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 
)

Definition at line 1894 of file fmgr.c.

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

References generate_unaccent_rules::args, exprType(), 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  )

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 
)

Definition at line 1940 of file fmgr.c.

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

References FmgrInfo::fn_expr, and get_call_expr_arg_stable().

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

◆ get_fn_expr_argtype()

◆ get_fn_expr_rettype()

Oid get_fn_expr_rettype ( FmgrInfo flinfo)

Definition at line 1853 of file fmgr.c.

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

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

Definition at line 2009 of file fmgr.c.

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

References FmgrInfo::fn_expr, and IsA.

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

◆ get_fn_opclass_options()

bytea * get_fn_opclass_options ( FmgrInfo flinfo)

Definition at line 2062 of file fmgr.c.

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

References Const::consttype, DatumGetByteaP, ereport, errcode(), errmsg(), ERROR, FmgrInfo::fn_expr, if(), 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 
)

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}
const Pg_magic_struct * magic
Definition: dfmgr.c:55
const char * name
Definition: fmgr.h:482
const char * version
Definition: fmgr.h:483

References DynamicFileList::filename, DynamicFileList::magic, Pg_magic_struct::name, and Pg_magic_struct::version.

Referenced by pg_get_loaded_modules().

◆ get_next_loaded_module()

DynamicFileList * get_next_loaded_module ( DynamicFileList dfptr)

Definition at line 431 of file dfmgr.c.

432{
433 return dfptr->next;
434}

References DynamicFileList::next.

Referenced by pg_get_loaded_modules().

◆ has_fn_opclass_options()

bool has_fn_opclass_options ( FmgrInfo flinfo)

Definition at line 2046 of file fmgr.c.

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

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

◆ InputFunctionCall()

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

Definition at line 1531 of file fmgr.c.

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

References CStringGetDatum(), elog, ERROR, fmgr_security_definer_cache::flinfo, FmgrInfo::fn_oid, FmgrInfo::fn_strict, FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), and 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 
)

Definition at line 1585 of file fmgr.c.

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

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

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

◆ load_external_function()

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

Definition at line 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 {
113 if (first_dir_separator(filename + 8) == NULL)
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 */
121 lib_handle = internal_load_library(fullname);
122
123 /* Return handle if caller wants it */
124 if (filehandle)
125 *filehandle = lib_handle;
126
127 /* Look up the function within the library. */
128 retval = dlsym(lib_handle, funcname);
129
130 if (retval == NULL && signalNotFound)
132 (errcode(ERRCODE_UNDEFINED_FUNCTION),
133 errmsg("could not find function \"%s\" in file \"%s\"",
134 funcname, fullname)));
135
136 pfree(fullname);
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:120
void * dlsym(void *handle, const char *symbol)
Definition: win32dlopen.c:61

References dlsym(), ereport, errcode(), errmsg(), ERROR, expand_dynamic_library_name(), 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 
)

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 */
161 (void) internal_load_library(fullname);
162
163 pfree(fullname);
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(), 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 
)

Definition at line 171 of file dfmgr.c.

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

References dlsym(), and funcname.

Referenced by fetch_finfo_record().

◆ OidFunctionCall0Coll()

Datum OidFunctionCall0Coll ( Oid  functionId,
Oid  collation 
)

Definition at line 1402 of file fmgr.c.

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

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

◆ OidFunctionCall1Coll()

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

Definition at line 1412 of file fmgr.c.

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

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

Definition at line 1422 of file fmgr.c.

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

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

Referenced by _bt_compare_scankey_args(), and index_recheck_constraint().

◆ OidFunctionCall3Coll()

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

Definition at line 1432 of file fmgr.c.

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

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

◆ OidFunctionCall4Coll()

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

Definition at line 1443 of file fmgr.c.

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

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

Referenced by restriction_selectivity().

◆ OidFunctionCall5Coll()

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

Definition at line 1454 of file fmgr.c.

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

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

Referenced by join_selectivity().

◆ OidFunctionCall6Coll()

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

Definition at line 1465 of file fmgr.c.

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

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

◆ OidFunctionCall7Coll()

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

Definition at line 1478 of file fmgr.c.

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

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

◆ OidFunctionCall8Coll()

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

Definition at line 1491 of file fmgr.c.

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

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

◆ OidFunctionCall9Coll()

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

Definition at line 1504 of file fmgr.c.

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

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

◆ OidInputFunctionCall()

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

Definition at line 1754 of file fmgr.c.

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

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

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

◆ OidOutputFunctionCall()

◆ OidReceiveFunctionCall()

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

Definition at line 1772 of file fmgr.c.

1774{
1775 FmgrInfo flinfo;
1776
1777 fmgr_info(functionId, &flinfo);
1778 return ReceiveFunctionCall(&flinfo, buf, typioparam, typmod);
1779}
Datum ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf, Oid typioparam, int32 typmod)
Definition: fmgr.c:1697
static char * buf
Definition: pg_test_fsync.c:72

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

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

◆ OidSendFunctionCall()

bytea * OidSendFunctionCall ( Oid  functionId,
Datum  val 
)

Definition at line 1782 of file fmgr.c.

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

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

Referenced by logicalrep_write_tuple(), and SendFunctionResult().

◆ OutputFunctionCall()

◆ pg_detoast_datum()

struct varlena * pg_detoast_datum ( struct varlena datum)

Definition at line 1797 of file fmgr.c.

1798{
1799 if (VARATT_IS_EXTENDED(datum))
1800 return detoast_attr(datum);
1801 else
1802 return datum;
1803}
struct varlena * detoast_attr(struct 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()

struct varlena * pg_detoast_datum_copy ( struct varlena datum)

Definition at line 1806 of file fmgr.c.

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

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

Referenced by tuple_data_split_internal().

◆ pg_detoast_datum_packed()

struct varlena * pg_detoast_datum_packed ( struct varlena datum)

Definition at line 1829 of file fmgr.c.

1830{
1831 if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum))
1832 return detoast_attr(datum);
1833 else
1834 return datum;
1835}
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()

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

Definition at line 1822 of file fmgr.c.

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

References detoast_attr_slice().

◆ ReceiveFunctionCall()

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

Definition at line 1697 of file fmgr.c.

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

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

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

◆ RestoreLibraryState()

void RestoreLibraryState ( char *  start_address)

Definition at line 741 of file dfmgr.c.

742{
743 while (*start_address != '\0')
744 {
745 internal_load_library(start_address);
746 start_address += strlen(start_address) + 1;
747 }
748}

References internal_load_library().

Referenced by ParallelWorkerMain().

◆ SendFunctionCall()

◆ SerializeLibraryState()

void SerializeLibraryState ( Size  maxsize,
char *  start_address 
)

Definition at line 719 of file dfmgr.c.

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

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

Referenced by InitializeParallelDSM().

◆ set_fn_opclass_options()

void set_fn_opclass_options ( FmgrInfo flinfo,
bytea options 
)

Definition at line 2035 of file fmgr.c.

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

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

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
547 if ((sep_ptr = first_dir_separator(str)) == NULL)
548 sep_ptr = str + strlen(str);
549
550 if (strlen(macro) != sep_ptr - str ||
551 strncmp(str, macro, strlen(macro)) != 0)
553 (errcode(ERRCODE_INVALID_NAME),
554 errmsg("invalid macro name in path: %s",
555 str)));
556
557 return psprintf("%s%s", value, sep_ptr);
558}
static struct @171 value

References Assert(), ereport, errcode(), errmsg(), ERROR, 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 41 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 40 of file fmgr.c.

Referenced by sepgsql_init_client_label().