31#include "utils/fmgroids.h"
43#define TEXTDOMAIN PG_TEXTDOMAIN("plperl")
47#include "perlchunks.h"
50#include "plperl_opmask.h"
130#define increment_prodesc_refcount(prodesc) \
131 ((prodesc)->fn_refcount++)
132#define decrement_prodesc_refcount(prodesc) \
134 Assert((prodesc)->fn_refcount > 0); \
135 if (--((prodesc)->fn_refcount) == 0) \
136 free_plperl_function(prodesc); \
302#if defined(WIN32) && PERL_VERSION_LT(5, 28, 0)
305#define setlocale_perl(a,b) Perl_setlocale(a,b)
393 static bool inited =
false;
408 gettext_noop(
"If true, trusted and untrusted Perl code will be compiled in strict mode."),
422 gettext_noop(
"Perl initialization code to execute when a Perl interpreter is initialized."),
444 gettext_noop(
"Perl initialization code to execute once when plperl is first used."),
452 gettext_noop(
"Perl initialization code to execute once when plperlu is first used."),
646 errmsg(
"cannot allocate multiple Perl interpreters on this platform")));
662 newXS(
"PostgreSQL::InServer::SPI::bootstrap",
665 eval_pv(
"PostgreSQL::InServer::SPI::bootstrap()",
FALSE);
670 errcontext(
"while executing PostgreSQL::InServer::SPI::bootstrap")));
674 interp_desc->
interp = interp;
757#define PLPERL_RESTORE_LOCALE(name, saved) \
759 if (saved != NULL) { setlocale_perl(name, saved); pfree(saved); } \
778#if defined(PERL_SYS_INIT3) && !defined(MYMALLOC)
809 elog(
ERROR,
"could not allocate Perl interpreter");
837#ifdef PLPERL_ENABLE_OPMASK_EARLY
854 errcontext(
"while parsing Perl initialization")));
860 errcontext(
"while running Perl initialization")));
862#ifdef PLPERL_RESTORE_LOCALE
923 if (interp && *interp)
984 eval_pv(
"my $a=chr(0x100); return $a =~ /\\xa9/i",
FALSE);
1032 errcontext(
"while executing plperl.on_plperl_init")));
1055 errcontext(
"while executing plperl.on_plperlu_init")));
1101 errmsg(
"Perl hash contains nonexistent column \"%s\"",
1106 errmsg(
"cannot set system attribute \"%s\"",
1150 else if (
sv_isa(
sv,
"PostgreSQL::InServer::ARRAY"))
1159 elog(
ERROR,
"could not get array reference from PostgreSQL::InServer::ARRAY object");
1183 for (
i = 0;
i <
len;
i++)
1203 errmsg(
"multidimensional arrays must have array expressions with matching dimensions")));
1208 errmsg(
"number of array dimensions exceeds the maximum allowed (%d)",
1218 errmsg(
"multidimensional arrays must have array expressions with matching dimensions")));
1235 errmsg(
"multidimensional arrays must have array expressions with matching dimensions")));
1278 errmsg(
"cannot convert Perl array to non-array type %s",
1283 memset(dims, 0,
sizeof(dims));
1289 &finfo, typioparam);
1295 for (
i = 0;
i < ndims;
i++)
1379 errmsg(
"cannot convert Perl hash to non-composite type %s",
1401 errmsg(
"function returning record called in context "
1402 "that cannot accept type record")));
1423 fcinfo, finfo, typioparam,
1473 &typoutput, &typisvarlena);
1532 if (info->
ndims == 0)
1556 gv_stashpv(
"PostgreSQL::InServer::ARRAY", 0));
1603 for (
i = first;
i < last;
i++)
1651 tupdesc =
tdata->tg_relation->rd_att;
1705 if (
tdata->tg_trigger->tgnargs > 0)
1710 for (
i = 0;
i <
tdata->tg_trigger->tgnargs;
i++)
1729 when =
"INSTEAD OF";
1737 level =
"STATEMENT";
1783 errmsg(
"$_TD->{new} does not exist")));
1787 errmsg(
"$_TD->{new} is not a hash reference")));
1790 tupdesc =
tdata->tg_relation->rd_att;
1791 natts = tupdesc->
natts;
1808 errmsg(
"Perl hash contains nonexistent column \"%s\"",
1813 errmsg(
"cannot set system attribute \"%s\"",
1817 if (attr->attgenerated)
1820 errmsg(
"cannot set generated column \"%s\"",
1926 MemSet(&flinfo, 0,
sizeof(flinfo));
1927 MemSet(&desc, 0,
sizeof(desc));
1932 desc.
proname =
"inline_code_block";
1963 elog(
ERROR,
"could not create internal procedure for anonymous code block");
2004 bool is_trigger =
false;
2027 else if (proc->prorettype !=
RECORDOID &&
2031 errmsg(
"PL/Perl functions cannot return type %s",
2038 for (
i = 0;
i < numargs;
i++)
2044 errmsg(
"PL/Perl functions cannot accept type %s",
2135 count =
call_pv(
"PostgreSQL::InServer::mkfunc",
2161 errmsg(
"didn't get a CODE reference from compiling function \"%s\"",
2178 newXS(
"PostgreSQL::InServer::Util::bootstrap",
2252 errmsg(
"didn't get a return item from function")));
2296 errmsg(
"couldn't fetch $_TD")));
2320 errmsg(
"didn't get a return item from trigger function")));
2363 errmsg(
"couldn't fetch $_TD")));
2383 errmsg(
"didn't get a return item from trigger function")));
2440 errmsg(
"set-valued function called in context that cannot accept a set")));
2445 errmsg(
"materialize mode required, but it is not allowed in this context")));
2489 errmsg(
"set-returning PL/Perl function must return "
2490 "reference to array or use return_next")));
2609 errmsg(
"ignoring modified row in DELETE trigger")));
2617 errmsg(
"result of PL/Perl trigger function must be undef, "
2618 "\"SKIP\", or \"MODIFY\"")));
2675 if (proc_ptr && proc_ptr->
proc_ptr)
2734 elog(
ERROR,
"cache lookup failed for function %u", fn_oid);
2834 elog(
ERROR,
"cache lookup failed for language %u",
2851 elog(
ERROR,
"cache lookup failed for type %u", rettype);
2864 errmsg(
"trigger functions can only be called "
2869 errmsg(
"PL/Perl functions cannot return type %s",
2894 for (
i = 0;
i < prodesc->
nargs;
i++)
2900 elog(
ERROR,
"cache lookup failed for type %u", argtype);
2908 errmsg(
"PL/Perl functions cannot accept type %s",
2955 elog(
ERROR,
"could not create PL/Perl internal procedure");
3040 for (
i = 0;
i < tupdesc->
natts;
i++)
3049 if (
att->attisdropped)
3052 if (
att->attgenerated)
3117 croak(
"SPI functions can not be used in END blocks");
3132 croak(
"SPI functions can not be used during function compilation");
3215 if (status > 0 && tuptable)
3225 errmsg(
"query result has too many rows to fit in a Perl array")));
3229 for (
i = 0;
i < processed;
i++)
3297 errmsg(
"cannot use return_next in a non-SETOF function")));
3320 errmsg(
"function returning record called in context "
3321 "that cannot accept type record")));
3330 if (tupdesc ==
NULL || tupdesc->
natts != 1)
3331 elog(
ERROR,
"expected single-column result descriptor for non-composite SETOF result");
3358 "PL/Perl return_next temporary cxt",
3371 errmsg(
"SETOF-composite-returning PL/Perl function "
3372 "must call return_next with reference to hash")));
3443 elog(
ERROR,
"SPI_cursor_open() failed:%s",
3600 "PL/Perl spi_prepare query",
3605 qdesc->plan_cxt = plan_cxt;
3606 qdesc->nargs = argc;
3617 "PL/Perl spi_prepare workspace",
3626 for (
i = 0;
i < argc;
i++)
3755 elog(
ERROR,
"spi_exec_prepared: Invalid prepared query passed");
3759 elog(
ERROR,
"spi_exec_prepared: plperl query_hash value vanished");
3761 if (
qdesc->nargs != argc)
3762 elog(
ERROR,
"spi_exec_prepared: expected %d argument(s), %d passed",
3763 qdesc->nargs, argc);
3780 nulls = (
char *)
palloc(argc);
3789 for (
i = 0;
i < argc;
i++)
3798 qdesc->argtypioparams[
i],
3800 nulls[
i] = isnull ?
'n' :
' ';
3878 elog(
ERROR,
"spi_query_prepared: Invalid prepared query passed");
3882 elog(
ERROR,
"spi_query_prepared: plperl query_hash value vanished");
3884 if (
qdesc->nargs != argc)
3885 elog(
ERROR,
"spi_query_prepared: expected %d argument(s), %d passed",
3886 qdesc->nargs, argc);
3893 nulls = (
char *)
palloc(argc);
3902 for (
i = 0;
i < argc;
i++)
3911 qdesc->argtypioparams[
i],
3913 nulls[
i] = isnull ?
'n' :
' ';
3927 elog(
ERROR,
"SPI_cursor_open() failed:%s",
3976 elog(
ERROR,
"spi_freeplan: Invalid prepared query passed");
3980 elog(
ERROR,
"spi_freeplan: plperl query_hash value vanished");
4150 char *procname = (
char *)
arg;
4153 errcontext(
"PL/Perl function \"%s\"", procname);
4162 char *procname = (
char *)
arg;
4165 errcontext(
"compilation of PL/Perl function \"%s\"", procname);
4184#if defined(WIN32) && PERL_VERSION_LT(5, 28, 0)
4193#ifdef USE_LOCALE_CTYPE
4211#ifdef USE_LOCALE_COLLATE
4230#ifdef USE_LOCALE_NUMERIC
#define DatumGetArrayTypeP(X)
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
ArrayType * construct_empty_array(Oid elmtype)
Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, int *dims, int *lbs, MemoryContext rcontext, bool release)
ArrayBuildState * initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext)
void deconstruct_array(const ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
static Datum values[MAXATTR]
#define TextDatumGetCString(d)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
const char * GetCommandTagName(CommandTag commandTag)
void domain_check(Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
ErrorContextCallback * error_context_stack
ErrorData * CopyErrorData(void)
void FlushErrorState(void)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
#define CALLED_AS_EVENT_TRIGGER(fcinfo)
@ SFRM_Materialize_Random
#define palloc_array(type, count)
#define palloc0_array(type, count)
#define palloc0_object(type)
bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid)
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
char * OidOutputFunctionCall(Oid functionId, Datum val)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
#define OidFunctionCall1(functionId, arg1)
#define DatumGetHeapTupleHeader(X)
#define PG_GETARG_POINTER(n)
#define PG_MODULE_MAGIC_EXT(...)
#define SizeForFunctionCallInfo(nargs)
#define DirectFunctionCall1(func, arg1)
#define LOCAL_FCINFO(name, nargs)
#define PG_FUNCTION_INFO_V1(funcname)
#define FunctionCall1(flinfo, arg1)
int get_func_arg_info(HeapTuple procTup, Oid **p_argtypes, char ***p_argnames, char **p_argmodes)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
@ TYPEFUNC_COMPOSITE_DOMAIN
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
void DefineCustomStringVariable(const char *name, const char *short_desc, const char *long_desc, char **valueAddr, const char *bootValue, GucContext context, int flags, GucStringCheckHook check_hook, GucStringAssignHook assign_hook, GucShowHook show_hook)
void DefineCustomBoolVariable(const char *name, const char *short_desc, const char *long_desc, bool *valueAddr, bool bootValue, GucContext context, int flags, GucBoolCheckHook check_hook, GucBoolAssignHook assign_hook, GucShowHook show_hook)
void MarkGUCPrefixReserved(const char *className)
bool check_function_bodies
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static int32 HeapTupleHeaderGetTypMod(const HeapTupleHeaderData *tup)
static TransactionId HeapTupleHeaderGetRawXmin(const HeapTupleHeaderData *tup)
static uint32 HeapTupleHeaderGetDatumLength(const HeapTupleHeaderData *tup)
static void * GETSTRUCT(const HeapTupleData *tuple)
static Oid HeapTupleHeaderGetTypeId(const HeapTupleHeaderData *tup)
void on_proc_exit(pg_on_exit_callback function, Datum arg)
bool ItemPointerEquals(const ItemPointerData *pointer1, const ItemPointerData *pointer2)
Oid get_element_type(Oid typid)
bool type_is_rowtype(Oid typid)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
Oid get_transform_tosql(Oid typid, Oid langid, List *trftypes)
void get_type_io_data(Oid typid, IOFuncSelector which_func, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *func)
char get_typtype(Oid typid)
Oid get_base_element_type(Oid typid)
Oid getTypeIOParam(HeapTuple typeTuple)
Oid get_transform_fromsql(Oid typid, Oid langid, List *trftypes)
bool pg_verifymbstr(const char *mbstr, int len, bool noError)
char * pg_server_to_any(const char *s, int len, int encoding)
void MemoryContextReset(MemoryContext context)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
void MemoryContextSetIdentifier(MemoryContext context, const char *id)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define ALLOCSET_SMALL_SIZES
#define CHECK_FOR_INTERRUPTS()
void pg_bindtextdomain(const char *domain)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
Datum oidout(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, Node *escontext)
FormData_pg_attribute * Form_pg_attribute
END_CATALOG_STRUCT typedef FormData_pg_language * Form_pg_language
List * oid_array_to_list(Datum datum)
END_CATALOG_STRUCT typedef FormData_pg_proc * Form_pg_proc
END_CATALOG_STRUCT typedef FormData_pg_type * Form_pg_type
static HTAB * plperl_interp_hash
static SV * plperl_call_perl_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo)
static char plperl_opmask[MAXO]
static void plperl_event_trigger_handler(PG_FUNCTION_ARGS)
static bool plperl_use_strict
HV * plperl_spi_exec_prepared(char *query, HV *attr, int argc, SV **argv)
static void _sv_to_datum_finfo(Oid typid, FmgrInfo *finfo, Oid *typioparam)
static Datum plperl_func_handler(PG_FUNCTION_ARGS)
static HTAB * plperl_proc_hash
static void set_interp_require(bool trusted)
static bool plperl_ending
SV * plperl_spi_prepare(char *query, int argc, SV **argv)
static void SvREFCNT_dec_current(SV *sv)
void plperl_return_next(SV *sv)
static SV * plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc, bool include_generated)
char * plperl_sv_to_literal(SV *sv, char *fqtypename)
static plperl_interp_desc * plperl_active_interp
Datum plperlu_call_handler(PG_FUNCTION_ARGS)
static SV * plperl_trigger_build_args(FunctionCallInfo fcinfo)
static PerlInterpreter * plperl_held_interp
static OP *(* pp_require_orig)(pTHX)
static HV * plperl_spi_execute_fetch_result(SPITupleTable *, uint64, int)
SV * plperl_spi_query(char *query)
static void plperl_trusted_init(void)
static SV * make_array_ref(plperl_array_info *info, int first, int last)
void plperl_spi_rollback(void)
Datum plperl_inline_handler(PG_FUNCTION_ARGS)
static HeapTuple plperl_build_tuple_result(HV *perlhash, TupleDesc td)
static void plperl_untrusted_init(void)
static void plperl_create_sub(plperl_proc_desc *desc, const char *s, Oid fn_oid)
Datum plperl_validator(PG_FUNCTION_ARGS)
static void plperl_init_shared_libs(pTHX)
#define increment_prodesc_refcount(prodesc)
static char * hek2cstr(HE *he)
static void plperl_destroy_interp(PerlInterpreter **)
EXTERN_C void boot_DynaLoader(pTHX_ CV *cv)
static char * strip_trailing_ws(const char *msg)
static OP * pp_require_safe(pTHX)
#define setlocale_perl(a, b)
SV * plperl_spi_query_prepared(char *query, int argc, SV **argv)
static void free_plperl_function(plperl_proc_desc *prodesc)
static SV * plperl_call_perl_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td)
EXTERN_C void boot_PostgreSQL__InServer__Util(pTHX_ CV *cv)
static void check_spi_usage_allowed(void)
static SV * plperl_hash_from_datum(Datum attr)
static void select_perl_context(bool trusted)
static Datum plperl_sv_to_datum(SV *sv, Oid typid, int32 typmod, FunctionCallInfo fcinfo, FmgrInfo *finfo, Oid typioparam, bool *isnull)
SV * plperl_spi_fetchrow(char *cursor)
static SV * plperl_event_trigger_build_args(FunctionCallInfo fcinfo)
static void plperl_fini(int code, Datum arg)
static void plperl_exec_callback(void *arg)
HV * plperl_spi_exec(char *query, int limit)
static void plperl_inline_callback(void *arg)
static SV * get_perl_array_ref(SV *sv)
static SV ** hv_fetch_string(HV *hv, const char *key)
#define decrement_prodesc_refcount(prodesc)
Datum plperlu_inline_handler(PG_FUNCTION_ARGS)
static void plperl_compile_callback(void *arg)
Datum plperlu_validator(PG_FUNCTION_ARGS)
void plperl_spi_freeplan(char *query)
static SV * plperl_ref_from_pg_array(Datum arg, Oid typid)
static Datum plperl_array_to_datum(SV *src, Oid typid, int32 typmod)
static char * plperl_on_init
static char * plperl_on_plperl_init
static SV * split_array(plperl_array_info *info, int first, int last, int nest)
static Datum plperl_trigger_handler(PG_FUNCTION_ARGS)
Datum plperl_call_handler(PG_FUNCTION_ARGS)
static SV ** hv_store_string(HV *hv, const char *key, SV *val)
static plperl_call_data * current_call_data
void plperl_util_elog(int level, SV *msg)
void plperl_spi_cursor_close(char *cursor)
static plperl_proc_desc * compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger)
static HeapTuple plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup)
static void plperl_return_next_internal(SV *sv)
static bool validate_plperl_function(plperl_proc_ptr *proc_ptr, HeapTuple procTup)
static void plperl_call_perl_event_trigger_func(plperl_proc_desc *desc, FunctionCallInfo fcinfo, SV *td)
static PerlInterpreter * plperl_init_interp(void)
static void array_to_datum_internal(AV *av, ArrayBuildState **astatep, int *ndims, int *dims, int cur_depth, Oid elemtypid, int32 typmod, FmgrInfo *finfo, Oid typioparam)
EXTERN_C void boot_PostgreSQL__InServer__SPI(pTHX_ CV *cv)
static char * plperl_on_plperlu_init
static Datum plperl_hash_to_datum(SV *src, TupleDesc td)
void plperl_spi_commit(void)
static void activate_interpreter(plperl_interp_desc *interp_desc)
static char * sv2cstr(SV *sv)
static void croak_cstr(const char *str)
static SV * cstr2sv(const char *str)
int pg_strcasecmp(const char *s1, const char *s2)
void PinPortal(Portal portal)
void UnpinPortal(Portal portal)
void FloatExceptionHandler(SIGNAL_ARGS)
static Datum PointerGetDatum(const void *X)
static Oid DatumGetObjectId(Datum X)
static Datum ObjectIdGetDatum(Oid X)
static char * DatumGetCString(Datum X)
static Pointer DatumGetPointer(Datum X)
static Datum CStringGetDatum(const char *X)
#define PERL_UNUSED_VAR(x)
Datum regtypein(PG_FUNCTION_ARGS)
ResourceOwner CurrentResourceOwner
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
int SPI_freeplan(SPIPlanPtr plan)
const char * SPI_result_code_string(int code)
SPITupleTable * SPI_tuptable
Portal SPI_cursor_find(const char *name)
int SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls, bool read_only, long tcount)
Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, const Datum *Values, const char *Nulls, bool read_only)
void SPI_cursor_fetch(Portal portal, bool forward, long count)
int SPI_register_trigger_data(TriggerData *tdata)
void SPI_freetuptable(SPITupleTable *tuptable)
SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes)
int SPI_keepplan(SPIPlanPtr plan)
void SPI_cursor_close(Portal portal)
int SPI_connect_ext(int options)
char * SPI_getnspname(Relation rel)
int SPI_execute(const char *src, bool read_only, long tcount)
char * SPI_getrelname(Relation rel)
#define SPI_OPT_NONATOMIC
#define SPI_ERROR_NOATTRIBUTE
void check_stack_depth(void)
struct ErrorContextCallback * previous
MemoryContext ecxt_per_query_memory
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]
SetFunctionReturnMode returnMode
Tuplestorestate * setResult
plperl_proc_desc * prodesc
Tuplestorestate * tuple_store
unsigned long fn_refcount
plperl_interp_desc * interp
plperl_proc_desc * proc_ptr
char query_name[NAMEDATALEN]
plperl_query_desc * query_data
void ReleaseSysCache(HeapTuple tuple)
Datum SysCacheGetAttrNotNull(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Datum SysCacheGetAttr(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
#define TRIGGER_FIRED_FOR_STATEMENT(event)
#define TRIGGER_FIRED_BY_DELETE(event)
#define TRIGGER_FIRED_BEFORE(event)
#define CALLED_AS_TRIGGER(fcinfo)
#define TRIGGER_FIRED_FOR_ROW(event)
#define TRIGGER_FIRED_AFTER(event)
#define TRIGGER_FIRED_BY_TRUNCATE(event)
#define TRIGGER_FIRED_BY_INSERT(event)
#define TRIGGER_FIRED_BY_UPDATE(event)
#define TRIGGER_FIRED_INSTEAD(event)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
#define ReleaseTupleDesc(tupdesc)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
Tuplestorestate * tuplestore_begin_heap(bool randomAccess, bool interXact, int maxKBytes)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple)
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
TupleDesc lookup_rowtype_tupdesc_domain(Oid type_id, int32 typmod, bool noError)
void BeginInternalSubTransaction(const char *name)
void RollbackAndReleaseCurrentSubTransaction(void)
void ReleaseCurrentSubTransaction(void)