PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plpy_main.h File Reference
#include "plpy_procedure.h"
Include dependency graph for plpy_main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PLyExecutionContext


typedef struct PLyExecutionContext PLyExecutionContext


PLyExecutionContextPLy_current_execution_context (void)
MemoryContext PLy_get_scratch_context (PLyExecutionContext *context)


PyObject * PLy_interp_globals

Typedef Documentation

Function Documentation

PLyExecutionContext* PLy_current_execution_context ( void  )

Definition at line 398 of file plpy_main.c.

References elog, ERROR, NULL, and PLy_execution_contexts.

Referenced by plpython_error_callback(), plpython_return_error_callback(), plpython_trigger_error_callback(), PLy_cursor_plan(), PLy_cursor_query(), PLy_input_tuple_funcs(), PLy_output_tuple_funcs(), PLy_spi_execute_plan(), PLy_spi_execute_query(), PLy_spi_prepare(), PLy_traceback(), PLyDict_FromTuple(), and PLyString_ToComposite().

399 {
401  elog(ERROR, "no Python function is currently executing");
403  return PLy_execution_contexts;
404 }
#define ERROR
Definition: elog.h:43
#define NULL
Definition: c.h:229
static PLyExecutionContext * PLy_execution_contexts
Definition: plpy_main.c:74
#define elog
Definition: elog.h:219
MemoryContext PLy_get_scratch_context ( PLyExecutionContext context)

Definition at line 407 of file plpy_main.c.

References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate(), NULL, PLyExecutionContext::scratch_ctx, and TopTransactionContext.

Referenced by PLyDict_FromTuple().

408 {
409  /*
410  * A scratch context might never be needed in a given plpython procedure,
411  * so allocate it on first request.
412  */
413  if (context->scratch_ctx == NULL)
414  context->scratch_ctx =
416  "PL/Python scratch context",
418  return context->scratch_ctx;
419 }
MemoryContext scratch_ctx
Definition: plpy_main.h:21
MemoryContext TopTransactionContext
Definition: mcxt.c:48
Definition: memutils.h:165
MemoryContext AllocSetContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
Definition: aset.c:322
#define NULL
Definition: c.h:229

Variable Documentation

PyObject* PLy_interp_globals

Definition at line 71 of file plpy_main.c.

Referenced by PLy_init_interp(), and PLy_procedure_compile().