47#define FUNCS_PER_USER 128
123 if (
k1->callResultType)
125 if (
k2->callResultType)
135 if (
k2->callResultType)
181 elog(
WARNING,
"trying to insert a function that already exists");
222 tupdesc =
function->fn_hashkey->callResultType;
229 elog(
WARNING,
"trying to delete function that does not exist");
265 hashkey->cacheEntrySize = cacheEntrySize;
326 hashkey->callResultType = tupdesc;
364 errmsg(
"could not determine actual argument "
365 "type for polymorphic function \"%s\"",
369 for (
i = 0;
i < numargs;
i++)
389 for (
i = 0;
i < numargs;
i++)
501 elog(
ERROR,
"cache lookup failed for function %u", funcOid);
#define Assert(condition)
#define OidIsValid(objectId)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define CALLED_AS_EVENT_TRIGGER(fcinfo)
Oid get_call_expr_argtype(Node *expr, int argnum)
bool resolve_polymorphic_argtypes(int numargs, Oid *argtypes, char *argmodes, Node *call_expr)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
@ TYPEFUNC_COMPOSITE_DOMAIN
static void compute_function_hashkey(FunctionCallInfo fcinfo, Form_pg_proc procStruct, CachedFunctionHashKey *hashkey, Size cacheEntrySize, bool includeResultType, bool forValidator)
static void cfunc_hashtable_init(void)
static uint32 cfunc_hash(const void *key, Size keysize)
static HTAB * cfunc_hashtable
static void cfunc_hashtable_insert(CachedFunction *function, CachedFunctionHashKey *func_key)
static int cfunc_match(const void *key1, const void *key2, Size keysize)
void cfunc_resolve_polymorphic_argtypes(int numargs, Oid *argtypes, char *argmodes, Node *call_expr, bool forValidator, const char *proname)
CachedFunction * cached_function_compile(FunctionCallInfo fcinfo, CachedFunction *function, CachedFunctionCompileCallback ccallback, CachedFunctionDeleteCallback dcallback, Size cacheEntrySize, bool includeResultType, bool forValidator)
static CachedFunction * cfunc_hashtable_lookup(CachedFunctionHashKey *func_key)
static void cfunc_hashtable_delete(CachedFunction *function)
static void delete_function(CachedFunction *func)
void(* CachedFunctionCompileCallback)(FunctionCallInfo fcinfo, HeapTuple procTup, const struct CachedFunctionHashKey *hashkey, struct CachedFunction *function, bool forValidator)
void(* CachedFunctionDeleteCallback)(struct CachedFunction *cfunc)
static uint32 hash_combine(uint32 a, uint32 b)
static Datum hash_any(const unsigned char *k, int keylen)
#define HeapTupleIsValid(tuple)
static TransactionId HeapTupleHeaderGetRawXmin(const HeapTupleHeaderData *tup)
static void * GETSTRUCT(const HeapTupleData *tuple)
bool ItemPointerEquals(const ItemPointerData *pointer1, const ItemPointerData *pointer2)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void pfree(void *pointer)
MemoryContext TopMemoryContext
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
on_exit_nicely_callback function
FormData_pg_proc * Form_pg_proc
static uint32 DatumGetUInt32(Datum X)
static Datum ObjectIdGetDatum(Oid X)
CachedFunctionHashKey key
CachedFunction * function
Oid argtypes[FUNC_MAX_ARGS]
CachedFunctionDeleteCallback dcallback
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define CALLED_AS_TRIGGER(fcinfo)
void FreeTupleDesc(TupleDesc tupdesc)
uint32 hashRowType(TupleDesc desc)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
bool equalRowTypes(TupleDesc tupdesc1, TupleDesc tupdesc2)