24#include "utils/fmgrprotos.h"
109 Oid result_typioparam;
118 elog(
ERROR,
"cache lookup failed for function %u",
119 fcinfo->flinfo->fn_oid);
127 ret =
SysCacheGetAttr(PROCOID, pl_tuple, Anum_pg_proc_prosrc, &isnull);
129 elog(
ERROR,
"could not find source text of function \"%s\"",
133 (
errmsg(
"source text of function \"%s\": %s",
141 "PL/Sample function",
151 for (
int i = 0;
i < numargs;
i++)
153 Oid argtype = pl_struct->proargtypes.values[
i];
158 elog(
ERROR,
"cache lookup failed for type %u", argtype);
161 fmgr_info_cxt(type_struct->typoutput, &(arg_out_func[
i]), proc_cxt);
166 (
errmsg(
"argument: %d; name: %s; value: %s",
171 prorettype = pl_struct->prorettype;
182 if (prorettype != TEXTOID)
188 elog(
ERROR,
"cache lookup failed for type %u", prorettype);
192 fmgr_info_cxt(pg_type_entry->typinput, &result_in_func, proc_cxt);
220 elog(
ERROR,
"not called by trigger manager");
232 elog(
ERROR,
"cache lookup failed for function %u",
233 fcinfo->flinfo->fn_oid);
243 ret =
SysCacheGetAttr(PROCOID, pl_tuple, Anum_pg_proc_prosrc, &isnull);
245 elog(
ERROR,
"could not find source text of function \"%s\"",
249 (
errmsg(
"source text of function \"%s\": %s",
339 (
errmsg(
"trigger arg[%i]: %s",
i,
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define CALLED_AS_EVENT_TRIGGER(fcinfo)
Datum InputFunctionCall(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
#define DirectFunctionCall1(func, arg1)
#define PG_RETURN_DATUM(x)
int get_func_arg_info(HeapTuple procTup, Oid **p_argtypes, char ***p_argnames, char **p_argmodes)
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
Oid getTypeIOParam(HeapTuple typeTuple)
char * pstrdup(const char *in)
void * palloc0(Size size)
MemoryContext TopMemoryContext
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
FormData_pg_proc * Form_pg_proc
static rewind_source * source
FormData_pg_type * Form_pg_type
static Datum plsample_func_handler(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(plsample_call_handler)
Datum plsample_call_handler(PG_FUNCTION_ARGS)
static HeapTuple plsample_trigger_handler(PG_FUNCTION_ARGS)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static char * DatumGetCString(Datum X)
int SPI_register_trigger_data(TriggerData *tdata)
char * SPI_getnspname(Relation rel)
char * SPI_getrelname(Relation rel)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int 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)
Datum textout(PG_FUNCTION_ARGS)