PostgreSQL Source Code git master
|
#include "postgres.h"
#include "catalog/pg_proc.h"
#include "commands/event_trigger.h"
#include "commands/trigger.h"
#include "common/hashfn.h"
#include "funcapi.h"
#include "utils/funccache.h"
#include "utils/hsearch.h"
#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
struct | CachedFunctionHashEntry |
Macros | |
#define | FUNCS_PER_USER 128 /* initial table size */ |
Typedefs | |
typedef struct CachedFunctionHashEntry | CachedFunctionHashEntry |
Functions | |
static uint32 | cfunc_hash (const void *key, Size keysize) |
static int | cfunc_match (const void *key1, const void *key2, Size keysize) |
static void | cfunc_hashtable_init (void) |
static CachedFunction * | cfunc_hashtable_lookup (CachedFunctionHashKey *func_key) |
static void | cfunc_hashtable_insert (CachedFunction *function, CachedFunctionHashKey *func_key) |
static void | cfunc_hashtable_delete (CachedFunction *function) |
static void | compute_function_hashkey (FunctionCallInfo fcinfo, Form_pg_proc procStruct, CachedFunctionHashKey *hashkey, Size cacheEntrySize, bool includeResultType, bool forValidator) |
void | cfunc_resolve_polymorphic_argtypes (int numargs, Oid *argtypes, char *argmodes, Node *call_expr, bool forValidator, const char *proname) |
static void | delete_function (CachedFunction *func) |
CachedFunction * | cached_function_compile (FunctionCallInfo fcinfo, CachedFunction *function, CachedFunctionCompileCallback ccallback, CachedFunctionDeleteCallback dcallback, Size cacheEntrySize, bool includeResultType, bool forValidator) |
Variables | |
static HTAB * | cfunc_hashtable = NULL |
#define FUNCS_PER_USER 128 /* initial table size */ |
Definition at line 47 of file funccache.c.
typedef struct CachedFunctionHashEntry CachedFunctionHashEntry |
CachedFunction * cached_function_compile | ( | FunctionCallInfo | fcinfo, |
CachedFunction * | function, | ||
CachedFunctionCompileCallback | ccallback, | ||
CachedFunctionDeleteCallback | dcallback, | ||
Size | cacheEntrySize, | ||
bool | includeResultType, | ||
bool | forValidator | ||
) |
Definition at line 480 of file funccache.c.
References Assert(), cfunc_hashtable_insert(), cfunc_hashtable_lookup(), compute_function_hashkey(), delete_function(), elog, ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_oid, function, GETSTRUCT(), HeapTupleHeaderGetRawXmin(), HeapTupleIsValid, ItemPointerEquals(), MemoryContextAllocZero(), ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), HeapTupleData::t_data, HeapTupleData::t_self, and TopMemoryContext.
Referenced by init_sql_fcache(), and plpgsql_compile().
Definition at line 85 of file funccache.c.
References CachedFunctionHashKey::argtypes, Assert(), CachedFunctionHashKey::callResultType, DatumGetUInt32(), hash_any(), hash_combine(), hashRowType(), sort-test::key, and CachedFunctionHashKey::nargs.
Referenced by cfunc_hashtable_init().
|
static |
Definition at line 207 of file funccache.c.
References cfunc_hashtable, elog, FreeTupleDesc(), function, HASH_REMOVE, hash_search(), and WARNING.
Referenced by delete_function().
|
static |
Definition at line 59 of file funccache.c.
References Assert(), cfunc_hash(), cfunc_hashtable, cfunc_match(), ctl, FUNCS_PER_USER, HASH_COMPARE, hash_create(), HASH_ELEM, and HASH_FUNCTION.
Referenced by cfunc_hashtable_insert().
|
static |
Definition at line 167 of file funccache.c.
References CachedFunctionHashKey::callResultType, cfunc_hashtable, cfunc_hashtable_init(), CreateTupleDescCopy(), elog, CachedFunctionHashEntry::function, function, HASH_ENTER, hash_search(), CachedFunctionHashEntry::key, MemoryContextSwitchTo(), TopMemoryContext, and WARNING.
Referenced by cached_function_compile().
|
static |
Definition at line 146 of file funccache.c.
References cfunc_hashtable, CachedFunctionHashEntry::function, HASH_FIND, and hash_search().
Referenced by cached_function_compile().
|
static |
Definition at line 109 of file funccache.c.
References CachedFunctionHashKey::argtypes, Assert(), CachedFunctionHashKey::callResultType, equalRowTypes(), and CachedFunctionHashKey::nargs.
Referenced by cfunc_hashtable_init().
void cfunc_resolve_polymorphic_argtypes | ( | int | numargs, |
Oid * | argtypes, | ||
char * | argmodes, | ||
Node * | call_expr, | ||
bool | forValidator, | ||
const char * | proname | ||
) |
Definition at line 348 of file funccache.c.
References ereport, errcode(), errmsg(), ERROR, get_call_expr_argtype(), i, OidIsValid, proname, and resolve_polymorphic_argtypes().
Referenced by compute_function_hashkey(), and plpgsql_compile_callback().
|
static |
Definition at line 247 of file funccache.c.
References CachedFunctionHashKey::argtypes, CachedFunctionHashKey::cacheEntrySize, CALLED_AS_EVENT_TRIGGER, CALLED_AS_TRIGGER, CachedFunctionHashKey::callResultType, cfunc_resolve_polymorphic_argtypes(), FunctionCallInfoBaseData::context, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_expr, FmgrInfo::fn_oid, FunctionCallInfoBaseData::fncollation, CachedFunctionHashKey::funcOid, get_call_result_type(), CachedFunctionHashKey::inputCollation, CachedFunctionHashKey::isEventTrigger, CachedFunctionHashKey::isTrigger, NameStr, CachedFunctionHashKey::nargs, TriggerData::tg_trigger, Trigger::tgoid, CachedFunctionHashKey::trigOid, TYPEFUNC_COMPOSITE, and TYPEFUNC_COMPOSITE_DOMAIN.
Referenced by cached_function_compile().
|
static |
Definition at line 433 of file funccache.c.
References cfunc_hashtable_delete(), CachedFunction::dcallback, and CachedFunction::use_count.
Referenced by cached_function_compile().
|
static |
Definition at line 39 of file funccache.c.
Referenced by cfunc_hashtable_delete(), cfunc_hashtable_init(), cfunc_hashtable_insert(), and cfunc_hashtable_lookup().