74 PyImport_ImportModule(
"plpy");
94 static PyObject *PLy_interp_safe_globals = NULL;
97 mainmod = PyImport_AddModule(
"__main__");
98 if (mainmod == NULL || PyErr_Occurred())
102 PLy_interp_safe_globals = PyDict_New();
103 if (PLy_interp_safe_globals == NULL)
128 elog(
ERROR,
"cache lookup failed for function %u", funcoid);
149 nonatomic = fcinfo->context &&
165 Oid funcoid = fcinfo->flinfo->fn_oid;
175 plerrcontext.
arg = exec_ctx;
231 MemSet(&flinfo, 0,
sizeof(flinfo));
232 fake_fcinfo->flinfo = &flinfo;
238 "__plpython_inline_block",
264 plerrcontext.
arg = exec_ctx;
295 switch (procStruct->prorettype)
300 case EVENT_TRIGGEROID:
337 elog(
ERROR,
"no Python function is currently executing");
352 "PL/Python scratch context",
379 elog(
ERROR,
"no Python function is currently executing");
#define MemSet(start, val, len)
ErrorContextCallback * error_context_stack
#define CALLED_AS_EVENT_TRIGGER(fcinfo)
bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid)
#define SizeForFunctionCallInfo(nargs)
#define PG_GETARG_DATUM(n)
#define LOCAL_FCINFO(name, nargs)
bool check_function_bodies
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
char * MemoryContextStrdup(MemoryContext context, const char *string)
void * MemoryContextAlloc(MemoryContext context, Size size)
MemoryContext TopTransactionContext
void pfree(void *pointer)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
MemoryContext PortalContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
void pg_bindtextdomain(const char *domain)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
FormData_pg_proc * Form_pg_proc
void PLy_exec_event_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc)
Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
HeapTuple PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc)
Datum plpython3_validator(PG_FUNCTION_ARGS)
PyObject * PLy_interp_globals
static void PLy_initialize(void)
PG_FUNCTION_INFO_V1(plpython3_validator)
static PLyTrigType PLy_procedure_is_trigger(Form_pg_proc procStruct)
static void plpython_inline_error_callback(void *arg)
static PLyExecutionContext * PLy_execution_contexts
Datum plpython3_inline_handler(PG_FUNCTION_ARGS)
PLyExecutionContext * PLy_current_execution_context(void)
static void plpython_error_callback(void *arg)
MemoryContext PLy_get_scratch_context(PLyExecutionContext *context)
PG_MODULE_MAGIC_EXT(.name="plpython",.version=PG_VERSION)
static PLyExecutionContext * PLy_push_execution_context(bool atomic_context)
static void PLy_pop_execution_context(void)
static void PLy_init_interp(void)
Datum plpython3_call_handler(PG_FUNCTION_ARGS)
PyMODINIT_FUNC PyInit_plpy(void)
char * PLy_procedure_name(PLyProcedure *proc)
void init_procedure_caches(void)
PLyProcedure * PLy_procedure_get(Oid fn_oid, Oid fn_rel, PLyTrigType is_trigger)
void PLy_procedure_compile(PLyProcedure *proc, const char *src)
void PLy_procedure_delete(PLyProcedure *proc)
List * explicit_subtransactions
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
#define RelationGetRelid(relation)
int SPI_connect_ext(int options)
#define SPI_OPT_NONATOMIC
struct ErrorContextCallback * previous
void(* callback)(void *arg)
struct PLyExecutionContext * next
MemoryContext scratch_ctx
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define CALLED_AS_TRIGGER(fcinfo)