PostgreSQL Source Code git master
|
#include "postgres.h"
#include <tcl.h>
#include <unistd.h>
#include <fcntl.h>
#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/event_trigger.h"
#include "commands/trigger.h"
#include "executor/spi.h"
#include "fmgr.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "parser/parse_func.h"
#include "parser/parse_type.h"
#include "pgstat.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/regproc.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "pltclerrcodes.h"
Go to the source code of this file.
Data Structures | |
struct | pltcl_interp_desc |
struct | pltcl_proc_desc |
struct | pltcl_query_desc |
struct | pltcl_proc_key |
struct | pltcl_proc_ptr |
struct | pltcl_call_state |
struct | TclExceptionNameMap |
Macros | |
#define | HAVE_TCL_VERSION(maj, min) |
#define | CONST86 |
#define | TEXTDOMAIN PG_TEXTDOMAIN("pltcl") |
#define | UTF_BEGIN |
#define | UTF_END |
#define | UTF_U2E(x) (_pltcl_utf_dst = utf_u2e(_pltcl_utf_src = (x))) |
#define | UTF_E2U(x) (_pltcl_utf_dst = utf_e2u(_pltcl_utf_src = (x))) |
Typedefs | |
typedef int | Tcl_Size |
typedef struct pltcl_interp_desc | pltcl_interp_desc |
typedef struct pltcl_proc_desc | pltcl_proc_desc |
typedef struct pltcl_query_desc | pltcl_query_desc |
typedef struct pltcl_proc_key | pltcl_proc_key |
typedef struct pltcl_proc_ptr | pltcl_proc_ptr |
typedef struct pltcl_call_state | pltcl_call_state |
Functions | |
static char * | utf_u2e (const char *src) |
static char * | utf_e2u (const char *src) |
static void | pltcl_init_interp (pltcl_interp_desc *interp_desc, Oid prolang, bool pltrusted) |
static pltcl_interp_desc * | pltcl_fetch_interp (Oid prolang, bool pltrusted) |
static void | call_pltcl_start_proc (Oid prolang, bool pltrusted) |
static void | start_proc_error_callback (void *arg) |
static Datum | pltcl_handler (PG_FUNCTION_ARGS, bool pltrusted) |
static Datum | pltcl_func_handler (PG_FUNCTION_ARGS, pltcl_call_state *call_state, bool pltrusted) |
static HeapTuple | pltcl_trigger_handler (PG_FUNCTION_ARGS, pltcl_call_state *call_state, bool pltrusted) |
static void | pltcl_event_trigger_handler (PG_FUNCTION_ARGS, pltcl_call_state *call_state, bool pltrusted) |
static void | throw_tcl_error (Tcl_Interp *interp, const char *proname) |
static pltcl_proc_desc * | compile_pltcl_function (Oid fn_oid, Oid tgreloid, bool is_event_trigger, bool pltrusted) |
static int | pltcl_elog (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static void | pltcl_construct_errorCode (Tcl_Interp *interp, ErrorData *edata) |
static const char * | pltcl_get_condition_name (int sqlstate) |
static int | pltcl_quote (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_argisnull (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_returnnull (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_returnnext (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_SPI_execute (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_process_SPI_result (Tcl_Interp *interp, const char *arrayname, Tcl_Obj *loop_body, int spi_rc, SPITupleTable *tuptable, uint64 ntuples) |
static int | pltcl_SPI_prepare (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_SPI_execute_plan (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_subtransaction (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_commit (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static int | pltcl_rollback (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
static void | pltcl_subtrans_begin (MemoryContext oldcontext, ResourceOwner oldowner) |
static void | pltcl_subtrans_commit (MemoryContext oldcontext, ResourceOwner oldowner) |
static void | pltcl_subtrans_abort (Tcl_Interp *interp, MemoryContext oldcontext, ResourceOwner oldowner) |
static void | pltcl_set_tuple_values (Tcl_Interp *interp, const char *arrayname, uint64 tupno, HeapTuple tuple, TupleDesc tupdesc) |
static Tcl_Obj * | pltcl_build_tuple_argument (HeapTuple tuple, TupleDesc tupdesc, bool include_generated) |
static HeapTuple | pltcl_build_tuple_result (Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc, pltcl_call_state *call_state) |
static void | pltcl_init_tuple_store (pltcl_call_state *call_state) |
static ClientData | pltcl_InitNotifier (void) |
static void | pltcl_FinalizeNotifier (ClientData clientData) |
static void | pltcl_SetTimer (CONST86 Tcl_Time *timePtr) |
static void | pltcl_AlertNotifier (ClientData clientData) |
static void | pltcl_CreateFileHandler (int fd, int mask, Tcl_FileProc *proc, ClientData clientData) |
static void | pltcl_DeleteFileHandler (int fd) |
static void | pltcl_ServiceModeHook (int mode) |
static int | pltcl_WaitForEvent (CONST86 Tcl_Time *timePtr) |
void | _PG_init (void) |
PG_FUNCTION_INFO_V1 (pltcl_call_handler) | |
Datum | pltcl_call_handler (PG_FUNCTION_ARGS) |
PG_FUNCTION_INFO_V1 (pltclu_call_handler) | |
Datum | pltclu_call_handler (PG_FUNCTION_ARGS) |
Variables | |
PG_MODULE_MAGIC | |
static char * | pltcl_start_proc = NULL |
static char * | pltclu_start_proc = NULL |
static bool | pltcl_pm_init_done = false |
static Tcl_Interp * | pltcl_hold_interp = NULL |
static HTAB * | pltcl_interp_htab = NULL |
static HTAB * | pltcl_proc_htab = NULL |
static pltcl_call_state * | pltcl_current_call_state = NULL |
static const TclExceptionNameMap | exception_name_map [] |
#define HAVE_TCL_VERSION | ( | maj, | |
min | |||
) |
#define TEXTDOMAIN PG_TEXTDOMAIN("pltcl") |
#define UTF_BEGIN |
#define UTF_END |
typedef struct pltcl_call_state pltcl_call_state |
typedef struct pltcl_interp_desc pltcl_interp_desc |
typedef struct pltcl_proc_desc pltcl_proc_desc |
typedef struct pltcl_proc_key pltcl_proc_key |
typedef struct pltcl_proc_ptr pltcl_proc_ptr |
typedef struct pltcl_query_desc pltcl_query_desc |
void _PG_init | ( | void | ) |
Definition at line 405 of file pltcl.c.
References DefineCustomStringVariable(), elog, HASHCTL::entrysize, ERROR, gettext_noop, HASH_BLOBS, hash_create(), HASH_ELEM, HASHCTL::keysize, MarkGUCPrefixReserved(), pg_bindtextdomain(), PGC_SUSET, 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, and TEXTDOMAIN.
|
static |
Definition at line 594 of file pltcl.c.
References ACL_EXECUTE, aclcheck_error(), ACLCHECK_OK, ErrorContextCallback::arg, ErrorContextCallback::callback, elog, ereport, errcode(), errmsg(), ERROR, error_context_stack, fmgr_info(), FunctionCallInvoke, GETSTRUCT, GetUserId(), HeapTupleIsValid, InitFunctionCallInfoData, InvalidOid, InvokeFunctionExecuteHook, LOCAL_FCINFO, LookupFuncName(), object_aclcheck(), OBJECT_FUNCTION, ObjectIdGetDatum(), pgstat_end_function_usage(), pgstat_init_function_usage(), pltcl_start_proc, pltclu_start_proc, ErrorContextCallback::previous, ReleaseSysCache(), SearchSysCache1(), start_proc_error_callback(), stringToQualifiedNameList(), and unconstify.
Referenced by pltcl_init_interp().
|
static |
Definition at line 1414 of file pltcl.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, pltcl_proc_desc::arg_is_rowtype, pltcl_proc_desc::arg_out_func, Assert, buf, pltcl_proc_desc::domain_info, elog, ereport, errcode(), errmsg(), ERROR, fmgr_info_cxt(), pltcl_proc_desc::fn_cxt, pltcl_proc_desc::fn_readonly, pltcl_proc_desc::fn_refcount, pltcl_proc_desc::fn_retisdomain, pltcl_proc_desc::fn_retisset, pltcl_proc_desc::fn_retistuple, pltcl_proc_desc::fn_tid, pltcl_proc_desc::fn_xmin, format_procedure(), format_type_be(), FUNC_MAX_ARGS, GETSTRUCT, getTypeIOParam(), GetUserId(), HASH_ENTER, hash_search(), HeapTupleHeaderGetRawXmin, HeapTupleIsValid, i, pltcl_proc_desc::internal_proname, pltcl_interp_desc::interp, pltcl_proc_desc::interp_desc, InvalidOid, pltcl_proc_key::is_trigger, ItemPointerEquals(), pltcl_proc_desc::lanpltrusted, MemoryContextDelete(), MemoryContextSetIdentifier(), MemoryContextSwitchTo(), pltcl_proc_desc::nargs, ObjectIdGetDatum(), OidIsValid, palloc0(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pltcl_fetch_interp(), pltcl_proc_htab, pltcl_proc_key::proc_id, pltcl_proc_ptr::proc_ptr, pstrdup(), ReleaseSysCache(), pltcl_proc_desc::result_in_func, pltcl_proc_desc::result_typid, pltcl_proc_desc::result_typioparam, SearchSysCache1(), snprintf, SysCacheGetAttrNotNull(), HeapTupleData::t_data, HeapTupleData::t_self, TextDatumGetCString, TopMemoryContext, type_is_rowtype(), pltcl_proc_key::user_id, pltcl_proc_desc::user_proname, UTF_BEGIN, UTF_E2U, UTF_END, and utf_u2e().
Referenced by pltcl_event_trigger_handler(), pltcl_func_handler(), and pltcl_trigger_handler().
PG_FUNCTION_INFO_V1 | ( | pltcl_call_handler | ) |
PG_FUNCTION_INFO_V1 | ( | pltclu_call_handler | ) |
|
static |
|
static |
Definition at line 2144 of file pltcl.c.
References pltcl_call_state::fcinfo, FunctionCallInfoBaseData::nargs, PG_ARGISNULL, and pltcl_current_call_state.
Referenced by pltcl_init_interp().
|
static |
Definition at line 3185 of file pltcl.c.
References attname, getTypeOutputInfo(), heap_getattr(), i, NameStr, TupleDescData::natts, OidOutputFunctionCall(), pfree(), TupleDescAttr(), UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_func_handler(), and pltcl_trigger_handler().
|
static |
Definition at line 3261 of file pltcl.c.
References pltcl_call_state::attinmeta, BuildTupleFromCStrings(), domain_check(), pltcl_proc_desc::domain_info, elog, ereport, errcode(), errmsg(), ERROR, pltcl_proc_desc::fn_cxt, pltcl_proc_desc::fn_retisdomain, HeapTupleGetDatum(), i, TupleDescData::natts, palloc0(), pltcl_call_state::prodesc, RelationGetDescr, pltcl_proc_desc::result_typid, pltcl_call_state::ret_tupdesc, SPI_ERROR_NOATTRIBUTE, SPI_fnumber(), TriggerData::tg_relation, pltcl_call_state::trigdata, TupleDescAttr(), TupleDescGetAttInMetadata(), utf_u2e(), and values.
Referenced by pltcl_func_handler(), pltcl_returnnext(), and pltcl_trigger_handler().
Datum pltcl_call_handler | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 3020 of file pltcl.c.
References CopyErrorData(), CurrentMemoryContext, FlushErrorState(), FreeErrorData(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, pltcl_construct_errorCode(), SPI_commit(), UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_init_interp().
|
static |
Definition at line 1927 of file pltcl.c.
References ErrorData::column_name, ErrorData::constraint_name, ErrorData::context, ErrorData::datatype_name, ErrorData::detail, ErrorData::filename, ErrorData::funcname, ErrorData::hint, ErrorData::internalpos, ErrorData::internalquery, ErrorData::lineno, ErrorData::message, pltcl_get_condition_name(), ErrorData::schema_name, ErrorData::sqlerrcode, ErrorData::table_name, unpack_sql_state(), UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_commit(), pltcl_elog(), pltcl_rollback(), and pltcl_subtrans_abort().
|
static |
|
static |
|
static |
Definition at line 1840 of file pltcl.c.
References CopyErrorData(), CurrentMemoryContext, DEBUG2, ereport, errcode(), errmsg(), ERROR, FATAL, FlushErrorState(), FreeErrorData(), INFO, LOG, MemoryContextSwitchTo(), ErrorData::message, NOTICE, PG_CATCH, PG_END_TRY, PG_TRY, pltcl_construct_errorCode(), UTF_BEGIN, UTF_E2U, UTF_END, UTF_U2E, and WARNING.
Referenced by pltcl_init_interp().
|
static |
Definition at line 1315 of file pltcl.c.
References compile_pltcl_function(), elog, ERROR, EventTriggerData::event, pltcl_proc_desc::fn_refcount, GetCommandTagName(), pltcl_proc_desc::internal_proname, pltcl_interp_desc::interp, pltcl_proc_desc::interp_desc, InvalidOid, pltcl_call_state::prodesc, SPI_connect(), SPI_finish(), SPI_OK_FINISH, EventTriggerData::tag, throw_tcl_error(), pltcl_proc_desc::user_proname, and utf_e2u().
Referenced by pltcl_handler().
|
static |
Definition at line 564 of file pltcl.c.
References GetUserId(), HASH_ENTER, hash_search(), pltcl_interp_desc::interp, InvalidOid, pltcl_init_interp(), and pltcl_interp_htab.
Referenced by compile_pltcl_function().
|
static |
|
static |
Definition at line 798 of file pltcl.c.
References ReturnSetInfo::allowedModes, pltcl_proc_desc::arg_is_rowtype, pltcl_proc_desc::arg_out_func, Assert, pltcl_call_state::attinmeta, castNode, compile_pltcl_function(), CreateTupleDescCopy(), CurrentResourceOwner, DatumGetHeapTupleHeader, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, pltcl_proc_desc::fn_refcount, pltcl_proc_desc::fn_retisdomain, pltcl_proc_desc::fn_retisset, pltcl_proc_desc::fn_retistuple, get_call_result_type(), HeapTupleGetDatum(), HeapTupleHeaderGetDatumLength, HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, i, if(), InputFunctionCall(), pltcl_proc_desc::internal_proname, pltcl_interp_desc::interp, pltcl_proc_desc::interp_desc, InvalidOid, IsA, lookup_rowtype_tupdesc(), MemoryContextSwitchTo(), pltcl_proc_desc::nargs, OutputFunctionCall(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pltcl_build_tuple_argument(), pltcl_build_tuple_result(), pltcl_call_state::prodesc, ReleaseTupleDesc, pltcl_proc_desc::result_in_func, pltcl_proc_desc::result_typioparam, pltcl_call_state::ret_tupdesc, ReturnSetInfo::returnMode, pltcl_call_state::rsi, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SPI_connect_ext(), SPI_finish(), SPI_OK_FINISH, SPI_OPT_NONATOMIC, HeapTupleData::t_data, HeapTupleData::t_len, throw_tcl_error(), pltcl_call_state::tuple_store, pltcl_call_state::tuple_store_cxt, pltcl_call_state::tuple_store_owner, TupleDescGetAttInMetadata(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_RECORD, pltcl_proc_desc::user_proname, UTF_BEGIN, UTF_E2U, UTF_END, and utf_u2e().
Referenced by pltcl_handler().
|
static |
Definition at line 2072 of file pltcl.c.
References exception_name_map, i, and TclExceptionNameMap::label.
Referenced by pltcl_construct_errorCode().
|
static |
Definition at line 724 of file pltcl.c.
References Assert, CALLED_AS_EVENT_TRIGGER, CALLED_AS_TRIGGER, pltcl_call_state::fcinfo, pltcl_proc_desc::fn_cxt, pltcl_proc_desc::fn_refcount, MemoryContextDelete(), PG_END_TRY, PG_FINALLY, PG_TRY, pltcl_current_call_state, pltcl_event_trigger_handler(), pltcl_func_handler(), pltcl_trigger_handler(), PointerGetDatum(), and pltcl_call_state::prodesc.
Referenced by pltcl_call_handler(), and pltclu_call_handler().
|
static |
Definition at line 491 of file pltcl.c.
References call_pltcl_start_proc(), elog, ERROR, pltcl_interp_desc::interp, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pltcl_argisnull(), pltcl_commit(), pltcl_elog(), pltcl_hold_interp, pltcl_quote(), pltcl_returnnext(), pltcl_returnnull(), pltcl_rollback(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), pltcl_SPI_prepare(), pltcl_subtransaction(), pltcl_interp_desc::query_hash, snprintf, and pltcl_interp_desc::user_id.
Referenced by pltcl_fetch_interp().
|
static |
Definition at line 3345 of file pltcl.c.
References ReturnSetInfo::allowedModes, Assert, pltcl_call_state::attinmeta, CurrentResourceOwner, ReturnSetInfo::expectedDesc, MemoryContextSwitchTo(), pltcl_call_state::ret_tupdesc, pltcl_call_state::rsi, SFRM_Materialize_Random, pltcl_call_state::tuple_store, pltcl_call_state::tuple_store_cxt, pltcl_call_state::tuple_store_owner, TupleDescGetAttInMetadata(), tuplestore_begin_heap(), and work_mem.
Referenced by pltcl_returnnext().
|
static |
Definition at line 351 of file pltcl.c.
Referenced by _PG_init().
|
static |
Definition at line 2515 of file pltcl.c.
References i, pltcl_set_tuple_values(), SPI_freetuptable(), SPI_OK_DELETE, SPI_OK_DELETE_RETURNING, SPI_OK_INSERT, SPI_OK_INSERT_RETURNING, SPI_OK_MERGE, SPI_OK_MERGE_RETURNING, SPI_OK_REWRITTEN, SPI_OK_SELECT, SPI_OK_SELINTO, SPI_OK_UPDATE, SPI_OK_UPDATE_RETURNING, SPI_OK_UTILITY, SPI_result_code_string(), SPITupleTable::tupdesc, and SPITupleTable::vals.
Referenced by pltcl_SPI_execute(), and pltcl_SPI_execute_plan().
|
static |
Definition at line 2090 of file pltcl.c.
References palloc(), and pfree().
Referenced by pltcl_init_interp().
|
static |
Definition at line 2236 of file pltcl.c.
References BeginInternalSubTransaction(), CurrentMemoryContext, CurrentResourceOwner, elog, ERROR, pltcl_call_state::fcinfo, pltcl_proc_desc::fn_retisset, pltcl_proc_desc::fn_retistuple, InputFunctionCall(), TupleDescData::natts, PG_CATCH, PG_END_TRY, PG_TRY, pltcl_build_tuple_result(), pltcl_current_call_state, pltcl_init_tuple_store(), pltcl_subtrans_abort(), pltcl_subtrans_commit(), pltcl_call_state::prodesc, pltcl_proc_desc::result_in_func, pltcl_proc_desc::result_typioparam, pltcl_call_state::ret_tupdesc, pltcl_call_state::tuple_store, tuplestore_puttuple(), tuplestore_putvalues(), and utf_u2e().
Referenced by pltcl_init_interp().
|
static |
Definition at line 2198 of file pltcl.c.
References pltcl_call_state::fcinfo, FunctionCallInfoBaseData::isnull, and pltcl_current_call_state.
Referenced by pltcl_init_interp().
|
static |
Definition at line 3059 of file pltcl.c.
References CopyErrorData(), CurrentMemoryContext, FlushErrorState(), FreeErrorData(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, pltcl_construct_errorCode(), SPI_rollback(), UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_init_interp().
|
static |
|
static |
Definition at line 3099 of file pltcl.c.
References attname, getTypeOutputInfo(), heap_getattr(), i, NameStr, TupleDescData::natts, OidOutputFunctionCall(), pfree(), pstrdup(), TupleDescAttr(), unconstify, UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_process_SPI_result().
|
static |
|
static |
Definition at line 2406 of file pltcl.c.
References CurrentMemoryContext, CurrentResourceOwner, pltcl_proc_desc::fn_readonly, i, PG_CATCH, PG_END_TRY, PG_TRY, pltcl_current_call_state, pltcl_process_SPI_result(), pltcl_subtrans_abort(), pltcl_subtrans_begin(), pltcl_subtrans_commit(), pltcl_call_state::prodesc, SPI_execute(), SPI_processed, SPI_tuptable, UTF_BEGIN, UTF_END, and UTF_U2E.
Referenced by pltcl_init_interp().
|
static |
Definition at line 2756 of file pltcl.c.
References pltcl_query_desc::arginfuncs, pltcl_query_desc::argtypioparams, CurrentMemoryContext, CurrentResourceOwner, pltcl_proc_desc::fn_readonly, i, InputFunctionCall(), pltcl_proc_desc::interp_desc, j, pltcl_query_desc::nargs, palloc(), PG_CATCH, PG_END_TRY, PG_TRY, pltcl_query_desc::plan, pltcl_current_call_state, pltcl_process_SPI_result(), pltcl_subtrans_abort(), pltcl_subtrans_begin(), pltcl_subtrans_commit(), pltcl_call_state::prodesc, pltcl_interp_desc::query_hash, SPI_execute_plan(), SPI_processed, SPI_tuptable, UTF_BEGIN, UTF_END, and UTF_U2E.
Referenced by pltcl_init_interp().
|
static |
Definition at line 2628 of file pltcl.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, pltcl_query_desc::arginfuncs, pltcl_query_desc::argtypes, pltcl_query_desc::argtypioparams, CurrentMemoryContext, CurrentResourceOwner, elog, ERROR, fmgr_info_cxt(), getTypeInputInfo(), i, pltcl_proc_desc::interp_desc, MemoryContextDelete(), MemoryContextSwitchTo(), pltcl_query_desc::nargs, palloc(), palloc0(), parseTypeString(), PG_CATCH, PG_END_TRY, PG_TRY, pltcl_query_desc::plan, pltcl_current_call_state, pltcl_subtrans_abort(), pltcl_subtrans_begin(), pltcl_subtrans_commit(), pltcl_call_state::prodesc, pltcl_query_desc::qname, pltcl_interp_desc::query_hash, snprintf, SPI_keepplan(), SPI_prepare(), TopMemoryContext, UTF_BEGIN, UTF_END, and UTF_U2E.
Referenced by pltcl_init_interp().
|
static |
Definition at line 2377 of file pltcl.c.
References CopyErrorData(), CurrentResourceOwner, FlushErrorState(), FreeErrorData(), MemoryContextSwitchTo(), ErrorData::message, pltcl_construct_errorCode(), RollbackAndReleaseCurrentSubTransaction(), UTF_BEGIN, UTF_E2U, and UTF_END.
Referenced by pltcl_returnnext(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), and pltcl_SPI_prepare().
|
static |
Definition at line 2359 of file pltcl.c.
References BeginInternalSubTransaction(), and MemoryContextSwitchTo().
Referenced by pltcl_SPI_execute(), pltcl_SPI_execute_plan(), and pltcl_SPI_prepare().
|
static |
Definition at line 2368 of file pltcl.c.
References CurrentResourceOwner, MemoryContextSwitchTo(), and ReleaseCurrentSubTransaction().
Referenced by pltcl_returnnext(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), and pltcl_SPI_prepare().
|
static |
Definition at line 2972 of file pltcl.c.
References BeginInternalSubTransaction(), CurrentMemoryContext, CurrentResourceOwner, MemoryContextSwitchTo(), ReleaseCurrentSubTransaction(), and RollbackAndReleaseCurrentSubTransaction().
Referenced by pltcl_init_interp().
|
static |
Definition at line 1056 of file pltcl.c.
References Assert, compile_pltcl_function(), DatumGetCString(), DirectFunctionCall1, elog, ereport, errcode(), errmsg(), ERROR, pltcl_proc_desc::fn_refcount, i, pltcl_proc_desc::internal_proname, pltcl_interp_desc::interp, pltcl_proc_desc::interp_desc, NameStr, ObjectIdGetDatum(), oidout(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PG_USED_FOR_ASSERTS_ONLY, pltcl_build_tuple_argument(), pltcl_build_tuple_result(), pltcl_call_state::prodesc, RelationData::rd_id, RelationGetDescr, RelationGetRelid, SPI_connect(), SPI_finish(), SPI_getnspname(), SPI_getrelname(), SPI_OK_FINISH, SPI_register_trigger_data(), TriggerData::tg_event, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigtuple, Trigger::tgargs, Trigger::tgname, Trigger::tgnargs, throw_tcl_error(), pltcl_call_state::trigdata, TRIGGER_FIRED_AFTER, TRIGGER_FIRED_BEFORE, TRIGGER_FIRED_BY_DELETE, TRIGGER_FIRED_BY_INSERT, TRIGGER_FIRED_BY_TRUNCATE, TRIGGER_FIRED_BY_UPDATE, TRIGGER_FIRED_FOR_ROW, TRIGGER_FIRED_FOR_STATEMENT, TRIGGER_FIRED_INSTEAD, TupleDescAttr(), pltcl_proc_desc::user_proname, utf_e2u(), and utf_u2e().
Referenced by pltcl_handler().
|
static |
Datum pltclu_call_handler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 713 of file pltcl.c.
References pltcl_handler().
|
static |
Definition at line 681 of file pltcl.c.
References arg, and errcontext.
Referenced by call_pltcl_start_proc().
|
static |
Definition at line 1369 of file pltcl.c.
References ereport, errcode(), errcontext, errmsg(), ERROR, proname, pstrdup(), and utf_u2e().
Referenced by pltcl_event_trigger_handler(), pltcl_func_handler(), and pltcl_trigger_handler().
|
inlinestatic |
Definition at line 84 of file pltcl.c.
References pg_server_to_any(), and PG_UTF8.
Referenced by pltcl_event_trigger_handler(), and pltcl_trigger_handler().
|
inlinestatic |
Definition at line 78 of file pltcl.c.
References pg_any_to_server(), and PG_UTF8.
Referenced by compile_pltcl_function(), pltcl_build_tuple_result(), pltcl_func_handler(), pltcl_returnnext(), pltcl_trigger_handler(), and throw_tcl_error().
|
static |
Definition at line 261 of file pltcl.c.
Referenced by pltcl_get_condition_name().
|
static |
Definition at line 250 of file pltcl.c.
Referenced by pltcl_argisnull(), pltcl_handler(), pltcl_returnnext(), pltcl_returnnull(), pltcl_SPI_execute(), pltcl_SPI_execute_plan(), and pltcl_SPI_prepare().
|
static |
Definition at line 245 of file pltcl.c.
Referenced by _PG_init(), and pltcl_init_interp().
|
static |
Definition at line 246 of file pltcl.c.
Referenced by _PG_init(), and pltcl_fetch_interp().
|
static |
Definition at line 244 of file pltcl.c.
Referenced by _PG_init().
|
static |
Definition at line 247 of file pltcl.c.
Referenced by _PG_init(), and compile_pltcl_function().
|
static |
Definition at line 242 of file pltcl.c.
Referenced by _PG_init(), and call_pltcl_start_proc().
|
static |
Definition at line 243 of file pltcl.c.
Referenced by _PG_init(), and call_pltcl_start_proc().