PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_language.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 "funcapi.h"
#include "miscadmin.h"
#include "parser/parse_type.h"
#include "storage/ipc.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/hsearch.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "perlchunks.h"
#include "plperl.h"
#include "plperl_opmask.h"
Go to the source code of this file.
Data Structures | |
struct | plperl_interp_desc |
struct | plperl_proc_desc |
struct | plperl_proc_key |
struct | plperl_proc_ptr |
struct | plperl_call_data |
struct | plperl_query_desc |
struct | plperl_query_entry |
struct | plperl_array_info |
Macros | |
#define | TEXTDOMAIN PG_TEXTDOMAIN("plperl") |
#define | increment_prodesc_refcount(prodesc) ((prodesc)->fn_refcount++) |
#define | decrement_prodesc_refcount(prodesc) |
#define | setlocale_perl(a, b) Perl_setlocale(a,b) |
Typedefs | |
typedef struct plperl_interp_desc | plperl_interp_desc |
typedef struct plperl_proc_desc | plperl_proc_desc |
typedef struct plperl_proc_key | plperl_proc_key |
typedef struct plperl_proc_ptr | plperl_proc_ptr |
typedef struct plperl_call_data | plperl_call_data |
typedef struct plperl_query_desc | plperl_query_desc |
typedef struct plperl_query_entry | plperl_query_entry |
typedef struct plperl_array_info | plperl_array_info |
Variables | |
PG_MODULE_MAGIC | |
static HTAB * | plperl_interp_hash = NULL |
static HTAB * | plperl_proc_hash = NULL |
static plperl_interp_desc * | plperl_active_interp = NULL |
static PerlInterpreter * | plperl_held_interp = NULL |
static bool | plperl_use_strict = false |
static char * | plperl_on_init = NULL |
static char * | plperl_on_plperl_init = NULL |
static char * | plperl_on_plperlu_init = NULL |
static bool | plperl_ending = false |
static OP *(* | pp_require_orig )(pTHX) = NULL |
static char | plperl_opmask [MAXO] |
static plperl_call_data * | current_call_data = NULL |
#define decrement_prodesc_refcount | ( | prodesc | ) |
#define increment_prodesc_refcount | ( | prodesc | ) | ((prodesc)->fn_refcount++) |
#define TEXTDOMAIN PG_TEXTDOMAIN("plperl") |
typedef struct plperl_array_info plperl_array_info |
typedef struct plperl_call_data plperl_call_data |
typedef struct plperl_interp_desc plperl_interp_desc |
typedef struct plperl_proc_desc plperl_proc_desc |
typedef struct plperl_proc_key plperl_proc_key |
typedef struct plperl_proc_ptr plperl_proc_ptr |
typedef struct plperl_query_desc plperl_query_desc |
typedef struct plperl_query_entry plperl_query_entry |
void _PG_init | ( | void | ) |
Definition at line 379 of file plperl.c.
References DefineCustomBoolVariable(), DefineCustomStringVariable(), HASHCTL::entrysize, gettext_noop, HASH_BLOBS, hash_create(), HASH_ELEM, HASHCTL::keysize, MarkGUCPrefixReserved(), pg_bindtextdomain(), PGC_SIGHUP, PGC_SUSET, PGC_USERSET, plperl_held_interp, plperl_init_interp(), plperl_interp_hash, plperl_on_init, plperl_on_plperl_init, plperl_on_plperlu_init, plperl_opmask, plperl_proc_hash, plperl_use_strict, and TEXTDOMAIN.
Definition at line 1299 of file plperl.c.
References fmgr_info(), and getTypeInputInfo().
Referenced by plperl_array_to_datum(), and plperl_sv_to_datum().
|
static |
Definition at line 683 of file plperl.c.
References Assert, plperl_interp_desc::interp, OidIsValid, plperl_active_interp, set_interp_require(), and plperl_interp_desc::user_id.
Referenced by compile_plperl_function(), free_plperl_function(), plperl_call_handler(), plperl_event_trigger_handler(), plperl_fini(), plperl_func_handler(), plperl_inline_handler(), plperl_trigger_handler(), and select_perl_context().
|
static |
Definition at line 1169 of file plperl.c.
References accumArrayResult(), av, CurrentMemoryContext, dTHX, ereport, errcode(), errmsg(), ERROR, get_perl_array_ref(), i, initArrayResult(), len, MAXDIM, and plperl_sv_to_datum().
Referenced by plperl_array_to_datum().
Referenced by plperl_init_shared_libs().
Referenced by select_perl_context().
Referenced by plperl_init_shared_libs().
|
static |
Definition at line 3101 of file plperl.c.
References current_call_data, plperl_ending, and plperl_call_data::prodesc.
Referenced by plperl_return_next(), plperl_spi_commit(), plperl_spi_cursor_close(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_execute_fetch_result(), plperl_spi_fetchrow(), plperl_spi_freeplan(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plperl_spi_rollback(), and plperl_sv_to_literal().
|
static |
Definition at line 2713 of file plperl.c.
References activate_interpreter(), ALLOCSET_SMALL_SIZES, AllocSetContextCreate, ErrorContextCallback::arg, plperl_proc_desc::arg_arraytype, plperl_proc_desc::arg_is_rowtype, plperl_proc_desc::arg_out_func, ErrorContextCallback::callback, elog, ereport, errcode(), errmsg(), ERROR, error_context_stack, fmgr_info_cxt(), plperl_proc_desc::fn_cxt, plperl_proc_desc::fn_readonly, plperl_proc_desc::fn_refcount, plperl_proc_desc::fn_retisarray, plperl_proc_desc::fn_retisset, plperl_proc_desc::fn_retistuple, plperl_proc_desc::fn_tid, plperl_proc_desc::fn_xmin, format_type_be(), free_plperl_function(), GETSTRUCT, getTypeIOParam(), GetUserId(), HASH_ENTER, HASH_FIND, hash_search(), HeapTupleHeaderGetRawXmin, HeapTupleIsValid, i, increment_prodesc_refcount, plperl_proc_desc::interp, InvalidOid, plperl_proc_key::is_trigger, plperl_proc_desc::lang_oid, plperl_proc_desc::lanpltrusted, MemoryContextDelete(), MemoryContextSetIdentifier(), MemoryContextSwitchTo(), NameStr, plperl_proc_desc::nargs, NIL, ObjectIdGetDatum(), oid_array_to_list(), palloc0(), pfree(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, plperl_active_interp, plperl_compile_callback(), plperl_create_sub(), plperl_proc_hash, ErrorContextCallback::previous, plperl_proc_key::proc_id, plperl_proc_ptr::proc_ptr, plperl_proc_desc::proname, pstrdup(), plperl_proc_desc::reference, ReleaseSysCache(), plperl_proc_desc::result_in_func, plperl_proc_desc::result_oid, plperl_proc_desc::result_typioparam, SearchSysCache1(), select_perl_context(), SysCacheGetAttr(), SysCacheGetAttrNotNull(), HeapTupleData::t_data, HeapTupleData::t_self, TextDatumGetCString, TopMemoryContext, plperl_proc_desc::trftypes, type_is_rowtype(), plperl_proc_key::user_id, and validate_plperl_function().
Referenced by plperl_event_trigger_handler(), plperl_func_handler(), plperl_trigger_handler(), and plperl_validator().
|
static |
Definition at line 2695 of file plperl.c.
References activate_interpreter(), Assert, plperl_proc_desc::fn_cxt, plperl_proc_desc::fn_refcount, plperl_proc_desc::interp, MemoryContextDelete(), plperl_active_interp, plperl_proc_desc::reference, and SvREFCNT_dec_current().
Referenced by compile_plperl_function().
|
static |
Definition at line 1137 of file plperl.c.
References dTHX, elog, ERROR, and hv_fetch_string().
Referenced by array_to_datum_internal(), plperl_func_handler(), and plperl_sv_to_datum().
|
static |
Definition at line 322 of file plperl.c.
References dTHX, HeUTF8, and sv2cstr().
Referenced by plperl_build_tuple_result(), and plperl_modify_tuple().
|
static |
Definition at line 4115 of file plperl.c.
References dTHX, sort-test::key, pfree(), pg_server_to_any(), and PG_UTF8.
Referenced by get_perl_array_ref(), plperl_modify_tuple(), and plperl_spi_exec_prepared().
|
static |
Definition at line 4088 of file plperl.c.
References dTHX, sort-test::key, pfree(), pg_server_to_any(), PG_UTF8, and val.
Referenced by plperl_create_sub(), plperl_event_trigger_build_args(), plperl_hash_from_tuple(), plperl_spi_execute_fetch_result(), and plperl_trigger_build_args().
|
static |
Definition at line 1592 of file plperl.c.
References cstr2sv(), DatumGetPointer(), dTHX, plperl_array_info::elem_is_rowtype, plperl_array_info::elements, FmgrInfo::fn_oid, FunctionCall1, i, newRV_noinc, plperl_array_info::nulls, OutputFunctionCall(), plperl_hash_from_datum(), plperl_array_info::proc, plperl_array_info::transform_proc, and val.
Referenced by split_array().
PG_FUNCTION_INFO_V1 | ( | plperl_call_handler | ) |
PG_FUNCTION_INFO_V1 | ( | plperl_inline_handler | ) |
PG_FUNCTION_INFO_V1 | ( | plperl_validator | ) |
PG_FUNCTION_INFO_V1 | ( | plperlu_call_handler | ) |
PG_FUNCTION_INFO_V1 | ( | plperlu_inline_handler | ) |
PG_FUNCTION_INFO_V1 | ( | plperlu_validator | ) |
Definition at line 1256 of file plperl.c.
References _sv_to_datum_finfo(), array_to_datum_internal(), construct_empty_array(), CurrentMemoryContext, dTHX, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_element_type(), i, makeMdArrayResult(), MAXDIM, and PointerGetDatum().
Referenced by plperl_sv_to_datum().
Definition at line 1074 of file plperl.c.
References dTHX, ereport, errcode(), errmsg(), ERROR, heap_form_tuple(), hek2cstr(), InvalidOid, sort-test::key, TupleDescData::natts, palloc(), palloc0(), pfree(), plperl_sv_to_datum(), SPI_ERROR_NOATTRIBUTE, SPI_fnumber(), TupleDescAttr, val, and values.
Referenced by plperl_hash_to_datum(), and plperl_return_next_internal().
Datum plperl_call_handler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1851 of file plperl.c.
References activate_interpreter(), CALLED_AS_EVENT_TRIGGER, CALLED_AS_TRIGGER, current_call_data, decrement_prodesc_refcount, plperl_call_data::fcinfo, MemSet, PG_END_TRY, PG_FINALLY, PG_TRY, plperl_active_interp, plperl_event_trigger_handler(), plperl_func_handler(), plperl_trigger_handler(), and plperl_call_data::prodesc.
Referenced by plperlu_call_handler().
|
static |
Definition at line 2339 of file plperl.c.
References call_sv, dTHX, ereport, errcode(), errmsg(), ERROR, ERRSV, get_sv, plperl_proc_desc::reference, strip_trailing_ws(), and sv2cstr().
Referenced by plperl_event_trigger_handler().
|
static |
Definition at line 2178 of file plperl.c.
References plperl_proc_desc::arg_arraytype, plperl_proc_desc::arg_is_rowtype, plperl_proc_desc::arg_out_func, FunctionCallInfoBaseData::args, Assert, call_sv, cstr2sv(), current_call_data, DatumGetPointer(), dTHX, ereport, errcode(), errmsg(), ERROR, ERRSV, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_oid, get_func_signature(), get_transform_fromsql(), i, NullableDatum::isnull, plperl_proc_desc::lang_oid, plperl_proc_desc::nargs, OidFunctionCall1, OidIsValid, OutputFunctionCall(), pfree(), PL_sv_undef, plperl_hash_from_datum(), plperl_ref_from_pg_array(), plperl_call_data::prodesc, plperl_proc_desc::reference, strip_trailing_ws(), sv2cstr(), plperl_proc_desc::trftypes, and NullableDatum::value.
Referenced by plperl_func_handler(), and plperl_inline_handler().
|
static |
Definition at line 2271 of file plperl.c.
References call_sv, FunctionCallInfoBaseData::context, cstr2sv(), dTHX, ereport, errcode(), errmsg(), ERROR, ERRSV, get_sv, i, plperl_proc_desc::reference, strip_trailing_ws(), sv2cstr(), Trigger::tgargs, and Trigger::tgnargs.
Referenced by plperl_trigger_handler().
|
static |
Definition at line 4150 of file plperl.c.
References arg, and errcontext.
Referenced by compile_plperl_function().
|
static |
Definition at line 2093 of file plperl.c.
References call_pv, cstr2sv(), dTHX, ereport, errcode(), errmsg(), ERROR, ERRSV, hv_store_string(), NAMEDATALEN, newRV_inc, newRV_noinc, PL_sv_no, plperl_use_strict, plperl_proc_desc::proname, plperl_proc_desc::reference, sprintf, strip_trailing_ws(), subname, and sv2cstr().
Referenced by compile_plperl_function(), and plperl_inline_handler().
|
static |
Definition at line 917 of file plperl.c.
References dTHX, PERL_UNUSED_VAR, and x.
Referenced by plperl_fini().
|
static |
Definition at line 1743 of file plperl.c.
References FunctionCallInfoBaseData::context, cstr2sv(), dTHX, EventTriggerData::event, GetCommandTagName(), hv_store_string(), newRV_noinc, and EventTriggerData::tag.
Referenced by plperl_event_trigger_handler().
|
static |
Definition at line 2630 of file plperl.c.
References activate_interpreter(), ErrorContextCallback::arg, ErrorContextCallback::callback, compile_plperl_function(), current_call_data, elog, ERROR, error_context_stack, increment_prodesc_refcount, plperl_proc_desc::interp, plperl_call_perl_event_trigger_func(), plperl_event_trigger_build_args(), plperl_exec_callback(), ErrorContextCallback::previous, plperl_call_data::prodesc, plperl_proc_desc::proname, SPI_connect(), SPI_finish(), SPI_OK_FINISH, and SvREFCNT_dec_current().
Referenced by plperl_call_handler().
|
static |
Definition at line 4138 of file plperl.c.
References arg, and errcontext.
Referenced by plperl_event_trigger_handler(), plperl_func_handler(), and plperl_trigger_handler().
|
static |
Definition at line 508 of file plperl.c.
References activate_interpreter(), DEBUG3, elog, hash_seq_init(), hash_seq_search(), plperl_interp_desc::interp, plperl_destroy_interp(), plperl_ending, plperl_held_interp, and plperl_interp_hash.
Referenced by select_perl_context().
|
static |
Definition at line 2400 of file plperl.c.
References activate_interpreter(), ReturnSetInfo::allowedModes, ErrorContextCallback::arg, ErrorContextCallback::callback, castNode, compile_plperl_function(), current_call_data, dTHX, elog, ereport, errcode(), errmsg(), ERROR, error_context_stack, ExprEndResult, plperl_proc_desc::fn_retisset, get_perl_array_ref(), i, if(), increment_prodesc_refcount, plperl_proc_desc::interp, IsA, ReturnSetInfo::isDone, plperl_call_perl_func(), plperl_exec_callback(), plperl_return_next_internal(), plperl_sv_to_datum(), ErrorContextCallback::previous, plperl_call_data::prodesc, plperl_proc_desc::proname, plperl_proc_desc::result_in_func, plperl_proc_desc::result_oid, plperl_proc_desc::result_typioparam, plperl_call_data::ret_tdesc, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SPI_connect_ext(), SPI_finish(), SPI_OK_FINISH, SPI_OPT_NONATOMIC, SvREFCNT_dec_current(), and plperl_call_data::tuple_store.
Referenced by plperl_call_handler().
|
static |
Definition at line 2993 of file plperl.c.
References DatumGetHeapTupleHeader, HeapTupleHeaderGetDatumLength, HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, lookup_rowtype_tupdesc(), plperl_hash_from_tuple(), ReleaseTupleDesc, HeapTupleData::t_data, and HeapTupleData::t_len.
Referenced by make_array_ref(), plperl_call_perl_func(), and plperl_hash_from_tuple().
|
static |
Definition at line 3021 of file plperl.c.
References attname, check_stack_depth(), cstr2sv(), current_call_data, DatumGetPointer(), dTHX, get_base_element_type(), get_transform_fromsql(), getTypeOutputInfo(), heap_getattr(), hv_store_string(), i, plperl_proc_desc::lang_oid, NameStr, TupleDescData::natts, newRV_noinc, OidFunctionCall1, OidIsValid, OidOutputFunctionCall(), pfree(), plperl_hash_from_datum(), plperl_ref_from_pg_array(), plperl_call_data::prodesc, plperl_proc_desc::trftypes, TupleDescAttr, and type_is_rowtype().
Referenced by plperl_hash_from_datum(), plperl_spi_execute_fetch_result(), plperl_spi_fetchrow(), and plperl_trigger_build_args().
Definition at line 1125 of file plperl.c.
References HeapTupleGetDatum(), and plperl_build_tuple_result().
Referenced by plperl_sv_to_datum().
|
static |
Definition at line 704 of file plperl.c.
References dTHX, elog, ereport, errcode(), errcontext, errmsg(), ERROR, ERRSV, FloatExceptionHandler(), PL_ppaddr, plperl_init_shared_libs(), plperl_on_init, plperl_opmask, pp_require_orig, pqsignal(), pstrdup(), setlocale, strip_trailing_ws(), and sv2cstr().
Referenced by _PG_init(), and select_perl_context().
|
static |
Definition at line 2166 of file plperl.c.
References boot_DynaLoader(), and boot_PostgreSQL__InServer__Util().
Referenced by plperl_init_interp().
|
static |
Definition at line 4162 of file plperl.c.
References errcontext.
Referenced by plperl_inline_handler().
Datum plperl_inline_handler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1893 of file plperl.c.
References activate_interpreter(), ErrorContextCallback::arg, InlineCodeBlock::atomic, ErrorContextCallback::callback, current_call_data, CurrentMemoryContext, elog, ERROR, error_context_stack, plperl_call_data::fcinfo, FmgrInfo::fn_mcxt, FmgrInfo::fn_oid, plperl_proc_desc::fn_readonly, plperl_proc_desc::fn_retisarray, plperl_proc_desc::fn_retisset, plperl_proc_desc::fn_retistuple, InvalidOid, plperl_proc_desc::lang_oid, InlineCodeBlock::langIsTrusted, InlineCodeBlock::langOid, plperl_proc_desc::lanpltrusted, LOCAL_FCINFO, MemSet, plperl_proc_desc::nargs, NIL, PG_END_TRY, PG_FINALLY, PG_GETARG_POINTER, PG_RETURN_VOID, PG_TRY, plperl_active_interp, plperl_call_perl_func(), plperl_create_sub(), plperl_inline_callback(), ErrorContextCallback::previous, plperl_call_data::prodesc, plperl_proc_desc::proname, plperl_proc_desc::reference, plperl_proc_desc::result_oid, select_perl_context(), SizeForFunctionCallInfo, InlineCodeBlock::source_text, SPI_connect_ext(), SPI_finish(), SPI_OK_FINISH, SPI_OPT_NONATOMIC, SvREFCNT_dec_current(), and plperl_proc_desc::trftypes.
Referenced by plperlu_inline_handler().
|
static |
Definition at line 1761 of file plperl.c.
References dTHX, ereport, errcode(), errmsg(), ERROR, heap_modify_tuple(), hek2cstr(), hv_fetch_string(), InvalidOid, sort-test::key, TupleDescData::natts, palloc0(), pfree(), plperl_sv_to_datum(), RelationData::rd_att, SPI_ERROR_NOATTRIBUTE, SPI_fnumber(), TriggerData::tg_relation, TupleDescAttr, and val.
Referenced by plperl_trigger_handler().
Definition at line 1479 of file plperl.c.
References arg, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, av, current_call_data, DatumGetArrayTypeP, deconstruct_array(), dTHX, plperl_array_info::elem_is_rowtype, plperl_array_info::elements, fmgr_info(), get_transform_fromsql(), get_type_io_data(), i, IOFunc_output, plperl_proc_desc::lang_oid, plperl_array_info::ndims, plperl_array_info::nelems, newRV_noinc, newSVuv, nitems, plperl_array_info::nulls, OidIsValid, palloc(), palloc0(), plperl_array_info::proc, plperl_call_data::prodesc, split_array(), plperl_array_info::transform_proc, plperl_proc_desc::trftypes, typalign, and type_is_rowtype().
Referenced by plperl_call_perl_func(), and plperl_hash_from_tuple().
void plperl_return_next | ( | SV * | sv | ) |
Definition at line 3240 of file plperl.c.
References check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), CurrentMemoryContext, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, and plperl_return_next_internal().
|
static |
Definition at line 3270 of file plperl.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ReturnSetInfo::allowedModes, Assert, plperl_call_data::cdomain_info, plperl_call_data::cdomain_oid, CreateTupleDescCopy(), current_call_data, CurrentMemoryContext, domain_check(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, ReturnSetInfo::expectedDesc, plperl_call_data::fcinfo, plperl_proc_desc::fn_retisset, plperl_proc_desc::fn_retistuple, get_call_result_type(), HeapTupleGetDatum(), if(), MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, OidIsValid, plperl_build_tuple_result(), plperl_sv_to_datum(), plperl_call_data::prodesc, plperl_proc_desc::result_in_func, plperl_proc_desc::result_oid, plperl_proc_desc::result_typioparam, FunctionCallInfoBaseData::resultinfo, plperl_call_data::ret_tdesc, SFRM_Materialize_Random, plperl_call_data::tmp_cxt, plperl_call_data::tuple_store, tuplestore_begin_heap(), tuplestore_puttuple(), tuplestore_putvalues(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, and work_mem.
Referenced by plperl_func_handler(), and plperl_return_next().
void plperl_spi_commit | ( | void | ) |
Definition at line 3986 of file plperl.c.
References check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), CurrentMemoryContext, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, and SPI_commit().
void plperl_spi_cursor_close | ( | char * | cursor | ) |
Definition at line 3546 of file plperl.c.
References check_spi_usage_allowed(), SPI_cursor_close(), SPI_cursor_find(), and UnpinPortal().
HV* plperl_spi_exec | ( | char * | query, |
int | limit | ||
) |
Definition at line 3128 of file plperl.c.
References BeginInternalSubTransaction(), check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), current_call_data, CurrentMemoryContext, CurrentResourceOwner, FlushErrorState(), plperl_proc_desc::fn_readonly, MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, pg_verifymbstr(), plperl_spi_execute_fetch_result(), plperl_call_data::prodesc, ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), SPI_execute(), SPI_processed, and SPI_tuptable.
HV* plperl_spi_exec_prepared | ( | char * | query, |
HV * | attr, | ||
int | argc, | ||
SV ** | argv | ||
) |
Definition at line 3710 of file plperl.c.
References plperl_query_desc::arginfuncs, plperl_query_desc::argtypes, plperl_query_desc::argtypioparams, BeginInternalSubTransaction(), check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), current_call_data, CurrentMemoryContext, CurrentResourceOwner, dTHX, elog, ERROR, FlushErrorState(), plperl_proc_desc::fn_readonly, HASH_FIND, hash_search(), hv_fetch_string(), i, MemoryContextSwitchTo(), ErrorData::message, plperl_query_desc::nargs, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_TRY, plperl_query_desc::plan, plperl_active_interp, plperl_spi_execute_fetch_result(), plperl_sv_to_datum(), plperl_call_data::prodesc, plperl_query_entry::query_data, plperl_interp_desc::query_hash, ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), SPI_execute_plan(), SPI_processed, and SPI_tuptable.
|
static |
Definition at line 3188 of file plperl.c.
References AV_SIZE_MAX, check_spi_usage_allowed(), cstr2sv(), dTHX, ereport, errcode(), errmsg(), ERROR, hv_store_string(), i, newRV_noinc, newSVuv, plperl_hash_from_tuple(), SPI_freetuptable(), SPI_result_code_string(), SPITupleTable::tupdesc, UV_MAX, and SPITupleTable::vals.
Referenced by plperl_spi_exec(), and plperl_spi_exec_prepared().
SV* plperl_spi_fetchrow | ( | char * | cursor | ) |
Definition at line 3471 of file plperl.c.
References BeginInternalSubTransaction(), check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), CurrentMemoryContext, CurrentResourceOwner, dTHX, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, PL_sv_undef, plperl_hash_from_tuple(), ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), SPI_cursor_close(), SPI_cursor_fetch(), SPI_cursor_find(), SPI_freetuptable(), SPI_processed, SPI_tuptable, SPITupleTable::tupdesc, UnpinPortal(), and SPITupleTable::vals.
void plperl_spi_freeplan | ( | char * | query | ) |
Definition at line 3955 of file plperl.c.
References check_spi_usage_allowed(), elog, ERROR, HASH_FIND, HASH_REMOVE, hash_search(), MemoryContextDelete(), plperl_query_desc::plan, plan, plperl_query_desc::plan_cxt, plperl_active_interp, plperl_query_entry::query_data, plperl_interp_desc::query_hash, and SPI_freeplan().
SV* plperl_spi_prepare | ( | char * | query, |
int | argc, | ||
SV ** | argv | ||
) |
Definition at line 3562 of file plperl.c.
References ALLOCSET_DEFAULT_SIZES, ALLOCSET_SMALL_SIZES, AllocSetContextCreate, plperl_query_desc::arginfuncs, plperl_query_desc::argtypes, plperl_query_desc::argtypioparams, BeginInternalSubTransaction(), CHECK_FOR_INTERRUPTS, check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), cstr2sv(), CurrentMemoryContext, CurrentResourceOwner, elog, ERROR, FlushErrorState(), fmgr_info_cxt(), getTypeInputInfo(), HASH_ENTER, HASH_REMOVE, hash_search(), i, MemoryContextDelete(), MemoryContextSwitchTo(), ErrorData::message, plperl_query_desc::nargs, palloc(), palloc0(), parseTypeString(), pfree(), PG_CATCH, PG_END_TRY, PG_TRY, pg_verifymbstr(), plperl_query_desc::plan, plan, plperl_query_desc::plan_cxt, plperl_active_interp, plperl_query_desc::qname, plperl_query_entry::query_data, plperl_interp_desc::query_hash, ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), snprintf, SPI_freeplan(), SPI_keepplan(), SPI_prepare(), SPI_result, SPI_result_code_string(), sv2cstr(), and TopMemoryContext.
SV* plperl_spi_query | ( | char * | query | ) |
Definition at line 3399 of file plperl.c.
References BeginInternalSubTransaction(), check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), cstr2sv(), CurrentMemoryContext, CurrentResourceOwner, elog, ERROR, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, PortalData::name, PG_CATCH, PG_END_TRY, PG_TRY, pg_verifymbstr(), PinPortal(), plan, ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), SPI_cursor_open(), SPI_freeplan(), SPI_prepare(), SPI_result, and SPI_result_code_string().
SV* plperl_spi_query_prepared | ( | char * | query, |
int | argc, | ||
SV ** | argv | ||
) |
Definition at line 3837 of file plperl.c.
References plperl_query_desc::arginfuncs, plperl_query_desc::argtypes, plperl_query_desc::argtypioparams, BeginInternalSubTransaction(), check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), cstr2sv(), current_call_data, CurrentMemoryContext, CurrentResourceOwner, elog, ERROR, FlushErrorState(), plperl_proc_desc::fn_readonly, HASH_FIND, hash_search(), i, MemoryContextSwitchTo(), ErrorData::message, PortalData::name, plperl_query_desc::nargs, palloc(), pfree(), PG_CATCH, PG_END_TRY, PG_TRY, PinPortal(), plperl_query_desc::plan, plperl_active_interp, plperl_sv_to_datum(), plperl_call_data::prodesc, plperl_query_entry::query_data, plperl_interp_desc::query_hash, ReleaseCurrentSubTransaction(), RollbackAndReleaseCurrentSubTransaction(), SPI_cursor_open(), SPI_result, and SPI_result_code_string().
void plperl_spi_rollback | ( | void | ) |
Definition at line 4012 of file plperl.c.
References check_spi_usage_allowed(), CopyErrorData(), croak_cstr(), CurrentMemoryContext, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, PG_CATCH, PG_END_TRY, PG_TRY, and SPI_rollback().
|
static |
Definition at line 1322 of file plperl.c.
References _sv_to_datum_finfo(), Assert, check_stack_depth(), current_call_data, domain_check(), ereport, errcode(), errmsg(), ERROR, format_type_be(), get_call_result_type(), get_perl_array_ref(), get_transform_tosql(), InputFunctionCall(), plperl_proc_desc::lang_oid, lookup_rowtype_tupdesc_domain(), OidFunctionCall1, pfree(), plperl_array_to_datum(), plperl_hash_to_datum(), PointerGetDatum(), plperl_call_data::prodesc, ReleaseTupleDesc, str, sv2cstr(), TupleDescData::tdtypeid, plperl_proc_desc::trftypes, type_is_rowtype(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, and TYPEFUNC_OTHER.
Referenced by array_to_datum_internal(), plperl_build_tuple_result(), plperl_func_handler(), plperl_modify_tuple(), plperl_return_next_internal(), plperl_spi_exec_prepared(), plperl_spi_query_prepared(), and plperl_sv_to_literal().
char* plperl_sv_to_literal | ( | SV * | sv, |
char * | fqtypename | ||
) |
Definition at line 1443 of file plperl.c.
References check_spi_usage_allowed(), CStringGetDatum(), DirectFunctionCall1, ereport, errcode(), errmsg(), ERROR, getTypeOutputInfo(), InvalidOid, OidIsValid, OidOutputFunctionCall(), plperl_sv_to_datum(), and regtypein().
|
static |
Definition at line 1630 of file plperl.c.
References av, FunctionCallInfoBaseData::context, cstr2sv(), DatumGetCString(), DirectFunctionCall1, dTHX, hv_store_string(), i, newRV_noinc, ObjectIdGetDatum(), oidout(), plperl_hash_from_tuple(), RelationData::rd_att, RelationData::rd_id, SPI_getnspname(), SPI_getrelname(), TriggerData::tg_event, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigtuple, Trigger::tgargs, Trigger::tgname, Trigger::tgnargs, 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, and TRIGGER_FIRED_INSTEAD.
Referenced by plperl_trigger_handler().
|
static |
Definition at line 2518 of file plperl.c.
References activate_interpreter(), ErrorContextCallback::arg, Assert, ErrorContextCallback::callback, compile_plperl_function(), current_call_data, elog, ereport, errcode(), errmsg(), ERROR, error_context_stack, if(), increment_prodesc_refcount, plperl_proc_desc::interp, pfree(), pg_strcasecmp(), PG_USED_FOR_ASSERTS_ONLY, plperl_call_perl_trigger_func(), plperl_exec_callback(), plperl_modify_tuple(), plperl_trigger_build_args(), PointerGetDatum(), ErrorContextCallback::previous, plperl_call_data::prodesc, plperl_proc_desc::proname, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_register_trigger_data(), sv2cstr(), SvREFCNT_dec_current(), TriggerData::tg_event, TriggerData::tg_newtuple, TriggerData::tg_trigtuple, TRIGGER_FIRED_BY_DELETE, TRIGGER_FIRED_BY_INSERT, TRIGGER_FIRED_BY_TRUNCATE, TRIGGER_FIRED_BY_UPDATE, and WARNING.
Referenced by plperl_call_handler().
|
static |
Definition at line 956 of file plperl.c.
References dTHX, ereport, errcode(), errcontext, errmsg(), ERROR, ERRSV, GvCV_set, isGV_with_GP, sort-test::key, PL_ppaddr, plperl_on_plperl_init, plperl_opmask, pp_require_orig, pp_require_safe(), strip_trailing_ws(), and sv2cstr().
Referenced by select_perl_context().
|
static |
Definition at line 1037 of file plperl.c.
References dTHX, ereport, errcode(), errcontext, errmsg(), ERROR, ERRSV, plperl_on_plperlu_init, strip_trailing_ws(), and sv2cstr().
Referenced by select_perl_context().
void plperl_util_elog | ( | int | level, |
SV * | msg | ||
) |
Definition at line 4049 of file plperl.c.
References CopyErrorData(), croak_cstr(), CurrentMemoryContext, elog, FlushErrorState(), MemoryContextSwitchTo(), ErrorData::message, pfree(), PG_CATCH, PG_END_TRY, PG_TRY, and sv2cstr().
Datum plperl_validator | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1987 of file plperl.c.
References check_function_bodies, CheckFunctionValidatorAccess(), compile_plperl_function(), elog, ereport, errcode(), errmsg(), ERROR, format_type_be(), get_func_arg_info(), get_typtype(), GETSTRUCT, HeapTupleIsValid, i, ObjectIdGetDatum(), PG_GETARG_OID, PG_RETURN_VOID, ReleaseSysCache(), and SearchSysCache1().
Referenced by plperlu_validator().
Datum plperlu_call_handler | ( | PG_FUNCTION_ARGS | ) |
Datum plperlu_inline_handler | ( | PG_FUNCTION_ARGS | ) |
Datum plperlu_validator | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 879 of file plperl.c.
References aTHX_, dVAR, len, name, and PL_sv_undef.
Referenced by plperl_trusted_init(), and set_interp_require().
|
static |
Definition at line 552 of file plperl.c.
References activate_interpreter(), boot_PostgreSQL__InServer__SPI(), dTHX, HASHCTL::entrysize, ereport, errcode(), errcontext, errmsg(), ERROR, ERRSV, GetUserId(), hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASH_STRINGS, plperl_interp_desc::interp, InvalidOid, HASHCTL::keysize, NAMEDATALEN, on_proc_exit(), plperl_active_interp, plperl_fini(), plperl_held_interp, plperl_init_interp(), plperl_interp_hash, plperl_trusted_init(), plperl_untrusted_init(), plperl_interp_desc::query_hash, set_interp_require(), strip_trailing_ws(), and sv2cstr().
Referenced by compile_plperl_function(), and plperl_inline_handler().
|
static |
Definition at line 489 of file plperl.c.
References PL_ppaddr, pp_require_orig, and pp_require_safe().
Referenced by activate_interpreter(), and select_perl_context().
|
static |
Definition at line 1558 of file plperl.c.
References Assert, check_stack_depth(), dTHX, i, make_array_ref(), plperl_array_info::ndims, plperl_array_info::nelems, and newRV_noinc.
Referenced by plperl_ref_from_pg_array().
|
static |
Definition at line 1060 of file plperl.c.
References len, pstrdup(), and res.
Referenced by plperl_call_perl_event_trigger_func(), plperl_call_perl_func(), plperl_call_perl_trigger_func(), plperl_create_sub(), plperl_init_interp(), plperl_trusted_init(), plperl_untrusted_init(), and select_perl_context().
|
inlinestatic |
Definition at line 311 of file plperl.c.
References dTHX.
Referenced by free_plperl_function(), plperl_event_trigger_handler(), plperl_func_handler(), plperl_inline_handler(), and plperl_trigger_handler().
|
static |
Definition at line 2666 of file plperl.c.
References decrement_prodesc_refcount, plperl_proc_desc::fn_tid, plperl_proc_desc::fn_xmin, HeapTupleHeaderGetRawXmin, ItemPointerEquals(), plperl_proc_ptr::proc_ptr, HeapTupleData::t_data, and HeapTupleData::t_self.
Referenced by compile_plperl_function().
|
static |
Definition at line 240 of file plperl.c.
Referenced by check_spi_usage_allowed(), plperl_call_handler(), plperl_call_perl_func(), plperl_event_trigger_handler(), plperl_func_handler(), plperl_hash_from_tuple(), plperl_inline_handler(), plperl_ref_from_pg_array(), plperl_return_next_internal(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_query_prepared(), plperl_sv_to_datum(), and plperl_trigger_handler().
|
static |
Definition at line 224 of file plperl.c.
Referenced by activate_interpreter(), compile_plperl_function(), free_plperl_function(), plperl_call_handler(), plperl_inline_handler(), plperl_spi_exec_prepared(), plperl_spi_freeplan(), plperl_spi_prepare(), plperl_spi_query_prepared(), and select_perl_context().
|
static |
Definition at line 235 of file plperl.c.
Referenced by check_spi_usage_allowed(), and plperl_fini().
|
static |
Definition at line 227 of file plperl.c.
Referenced by _PG_init(), plperl_fini(), and select_perl_context().
|
static |
Definition at line 222 of file plperl.c.
Referenced by _PG_init(), plperl_fini(), and select_perl_context().
|
static |
Definition at line 231 of file plperl.c.
Referenced by _PG_init(), and plperl_init_interp().
|
static |
Definition at line 232 of file plperl.c.
Referenced by _PG_init(), and plperl_trusted_init().
|
static |
Definition at line 233 of file plperl.c.
Referenced by _PG_init(), and plperl_untrusted_init().
|
static |
Definition at line 237 of file plperl.c.
Referenced by _PG_init(), plperl_init_interp(), and plperl_trusted_init().
|
static |
Definition at line 223 of file plperl.c.
Referenced by _PG_init(), and compile_plperl_function().
|
static |
Definition at line 230 of file plperl.c.
Referenced by _PG_init(), and plperl_create_sub().
Definition at line 236 of file plperl.c.
Referenced by plperl_init_interp(), plperl_trusted_init(), and set_interp_require().