241 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
242 errmsg(
"invalid transaction termination")));
256 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
257 errmsg(
"cannot commit while a subtransaction is active")));
341 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
342 errmsg(
"invalid transaction termination")));
347 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
348 errmsg(
"cannot roll back while a subtransaction is active")));
469 if (found && isCommit)
472 errmsg(
"transaction left non-empty SPI stack"),
473 errhint(
"Check for missing \"SPI_finish\" calls.")));
529 if (found && isCommit)
532 errmsg(
"subtransaction left non-empty SPI stack"),
533 errhint(
"Check for missing \"SPI_finish\" calls.")));
559 if (tuptable->
subid >= mySubid)
603 if (src == NULL || tcount < 0)
644 if (src == NULL ||
options == NULL)
658 plan.parserSetupArg =
options->params->parserSetupArg;
674 bool read_only,
long tcount)
682 if (
plan->nargs > 0 && Values == NULL)
735 bool read_only,
long tcount)
777 bool read_only,
bool fire_triggers,
long tcount)
785 if (
plan->nargs > 0 && Values == NULL)
799 snapshot, crosscheck_snapshot,
814 int nargs,
Oid *argtypes,
816 bool read_only,
long tcount)
823 if (src == NULL || nargs < 0 || tcount < 0)
826 if (nargs > 0 && (argtypes == NULL || Values == NULL))
838 plan.argtypes = argtypes;
839 plan.parserSetup = NULL;
840 plan.parserSetupArg = NULL;
873 if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL))
886 plan.cursor_options = cursorOptions;
888 plan.argtypes = argtypes;
889 plan.parserSetup = NULL;
890 plan.parserSetupArg = NULL;
909 if (src == NULL ||
options == NULL)
924 plan.argtypes = NULL;
941 void *parserSetupArg,
960 plan.cursor_options = cursorOptions;
962 plan.argtypes = NULL;
963 plan.parserSetup = parserSetup;
964 plan.parserSetupArg = parserSetupArg;
993 foreach(lc,
plan->plancache_list)
1034 foreach(lc,
plan->plancache_list)
1080 if (tuple == NULL || tupdesc == NULL)
1093 if (tupdesc->
tdtypeid == RECORDOID &&
1112 int numberOfAttributes;
1117 if (rel == NULL || tuple == NULL || natts < 0 ||
attnum == NULL || Values == NULL)
1135 n = (
bool *)
palloc(numberOfAttributes *
sizeof(
bool));
1141 for (
i = 0;
i < natts;
i++)
1181 for (res = 0; res < tupdesc->
natts; res++)
1185 if (
namestrcmp(&attr->attname, fname) == 0 &&
1186 !attr->attisdropped)
1192 return sysatt->attnum;
1205 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1231 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1257 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1262 return (
Datum) NULL;
1277 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1313 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1342 elog(
ERROR,
"SPI_palloc called while not connected to SPI");
1368 elog(
ERROR,
"SPI_datumTransfer called while not connected to SPI");
1392 if (tuptable == NULL)
1425 elog(
WARNING,
"attempt to delete invalid SPITupleTable %p", tuptable);
1475 int nargs,
Oid *argtypes,
1477 bool read_only,
int cursorOptions)
1483 if (src == NULL || nargs < 0)
1484 elog(
ERROR,
"SPI_cursor_open_with_args called with invalid arguments");
1486 if (nargs > 0 && (argtypes == NULL || Values == NULL))
1487 elog(
ERROR,
"SPI_cursor_open_with_args called with missing parameters");
1491 elog(
ERROR,
"SPI_cursor_open_with_args called while not connected");
1496 plan.cursor_options = cursorOptions;
1498 plan.argtypes = argtypes;
1499 plan.parserSetup = NULL;
1500 plan.parserSetupArg = NULL;
1541 if (src == NULL ||
options == NULL)
1542 elog(
ERROR,
"SPI_cursor_parse_open called with invalid arguments");
1546 elog(
ERROR,
"SPI_cursor_parse_open called while not connected");
1555 plan.parserSetupArg =
options->params->parserSetupArg;
1602 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
1603 errmsg(
"cannot open multi-query plan as cursor")));
1607 cmdtag =
"SELECT INTO";
1611 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
1613 errmsg(
"cannot open %s query as cursor", cmdtag)));
1621 elog(
ERROR,
"SPI_cursor_open called while not connected");
1630 if (
name == NULL ||
name[0] ==
'\0')
1650 spicallbackarg.
mode =
plan->parse_mode;
1652 spierrcontext.
arg = &spicallbackarg;
1719 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1720 errmsg(
"DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
1721 errdetail(
"Scrollable cursors must be READ ONLY.")));
1738 foreach(lc, stmt_list)
1744 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1746 errmsg(
"%s is not allowed in a non-volatile function",
1867 elog(
ERROR,
"invalid portal in SPI cursor operation");
1880 argIndex < 0 || argIndex >=
plan->nargs)
1885 return plan->argtypes[argIndex];
1956 foreach(lc,
plan->plancache_list)
1976 static char buf[64];
1981 return "SPI_ERROR_CONNECT";
1983 return "SPI_ERROR_COPY";
1985 return "SPI_ERROR_OPUNKNOWN";
1987 return "SPI_ERROR_UNCONNECTED";
1989 return "SPI_ERROR_ARGUMENT";
1991 return "SPI_ERROR_PARAM";
1993 return "SPI_ERROR_TRANSACTION";
1995 return "SPI_ERROR_NOATTRIBUTE";
1997 return "SPI_ERROR_NOOUTFUNC";
1999 return "SPI_ERROR_TYPUNKNOWN";
2001 return "SPI_ERROR_REL_DUPLICATE";
2003 return "SPI_ERROR_REL_NOT_FOUND";
2005 return "SPI_OK_CONNECT";
2007 return "SPI_OK_FINISH";
2009 return "SPI_OK_FETCH";
2011 return "SPI_OK_UTILITY";
2013 return "SPI_OK_SELECT";
2015 return "SPI_OK_SELINTO";
2017 return "SPI_OK_INSERT";
2019 return "SPI_OK_DELETE";
2021 return "SPI_OK_UPDATE";
2023 return "SPI_OK_CURSOR";
2025 return "SPI_OK_INSERT_RETURNING";
2027 return "SPI_OK_DELETE_RETURNING";
2029 return "SPI_OK_UPDATE_RETURNING";
2031 return "SPI_OK_REWRITTEN";
2033 return "SPI_OK_REL_REGISTER";
2035 return "SPI_OK_REL_UNREGISTER";
2037 return "SPI_OK_TD_REGISTER";
2039 return "SPI_OK_MERGE";
2041 return "SPI_OK_MERGE_RETURNING";
2044 sprintf(
buf,
"Unrecognized SPI code %d", code);
2062 return plan->plancache_list;
2098 spicallbackarg.
mode =
plan->parse_mode;
2100 spierrcontext.
arg = &spicallbackarg;
2132 elog(
ERROR,
"spi_dest_startup called while not connected to SPI");
2135 elog(
ERROR,
"improper call to spi_dest_startup");
2179 elog(
ERROR,
"spi_printtup called while not connected to SPI");
2182 if (tuptable == NULL)
2183 elog(
ERROR,
"improper call to spi_printtup");
2194 tuptable->
alloced = newalloced;
2225 List *raw_parsetree_list;
2226 List *plancache_list;
2234 spicallbackarg.
query = src;
2235 spicallbackarg.
mode =
plan->parse_mode;
2237 spierrcontext.
arg = &spicallbackarg;
2250 plancache_list =
NIL;
2252 foreach(list_item, raw_parsetree_list)
2270 if (
plan->parserSetup != NULL)
2276 plan->parserSetupArg,
2295 plan->parserSetupArg,
2296 plan->cursor_options,
2299 plancache_list =
lappend(plancache_list, plansource);
2302 plan->plancache_list = plancache_list;
2303 plan->oneshot =
false;
2333 List *raw_parsetree_list;
2334 List *plancache_list;
2342 spicallbackarg.
query = src;
2343 spicallbackarg.
mode =
plan->parse_mode;
2345 spierrcontext.
arg = &spicallbackarg;
2357 plancache_list =
NIL;
2359 foreach(list_item, raw_parsetree_list)
2368 plancache_list =
lappend(plancache_list, plansource);
2371 plan->plancache_list = plancache_list;
2372 plan->oneshot =
true;
2409 bool allow_nonatomic;
2410 bool pushed_active_snap =
false;
2423 allow_nonatomic =
options->allow_nonatomic &&
2429 spicallbackarg.
query = NULL;
2430 spicallbackarg.
mode =
plan->parse_mode;
2432 spierrcontext.
arg = &spicallbackarg;
2470 pushed_active_snap =
true;
2476 pushed_active_snap =
true;
2486 else if (plan_owner == NULL)
2497 (
errcode(ERRCODE_SYNTAX_ERROR),
2498 errmsg(
"empty query does not return tuples")));
2500 foreach(lc1,
plan->plancache_list)
2505 int query_index = 0;
2516 List *querytree_list;
2522 if (parsetree == NULL)
2523 querytree_list =
NIL;
2524 else if (
plan->parserSetup != NULL)
2530 plan->parserSetupArg,
2549 plan->parserSetupArg,
2550 plan->cursor_options,
2567 cmdtag =
"SELECT INTO";
2571 (
errcode(ERRCODE_SYNTAX_ERROR),
2573 errmsg(
"%s query does not return tuples", cmdtag)));
2612 if (!
options->read_only && !allow_nonatomic)
2614 if (pushed_active_snap)
2617 pushed_active_snap =
true;
2621 foreach(lc2, stmt_list)
2624 bool canSetTag =
stmt->canSetTag;
2637 if (
stmt->utilityStmt)
2658 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2660 errmsg(
"%s is not allowed in a non-volatile function",
2668 if (!
options->read_only && pushed_active_snap)
2685 if (
stmt->utilityStmt == NULL)
2698 snap, crosscheck_snapshot,
2705 plansource, query_index);
2717 if (allow_nonatomic)
2822 if (pushed_active_snap)
2865 for (
int i = 0;
i < nargs;
i++)
2872 prm->
ptype = argtypes[
i];
2927#ifdef SPI_EXECUTOR_STATS
2928 if (ShowExecutorStats)
2938 if (queryDesc->
cplan)
2946 elog(
ERROR,
"ExecutorStart() failed unexpectedly");
2957 elog(
ERROR,
"consistency check on SPI tuple count failed");
2964#ifdef SPI_EXECUTOR_STATS
2965 if (ShowExecutorStats)
2981 const char *query = carg->
query;
2982 int syntaxerrposition;
2992 if (syntaxerrposition > 0)
3004 errcontext(
"PL/pgSQL expression \"%s\"", query);
3009 errcontext(
"PL/pgSQL assignment \"%s\"", query);
3031 elog(
ERROR,
"invalid portal in SPI cursor operation");
3035 elog(
ERROR,
"SPI cursor operation called while not connected");
3060 elog(
ERROR,
"consistency check on SPI tuple count failed");
3138 bool failed =
false;
3140 if (tuptable == NULL)
3142 else if (processed != tuptable->
numvals)
3188 if (
plan->nargs > 0)
3204 foreach(lc,
plan->plancache_list)
3253 if (
plan->nargs > 0)
3264 foreach(lc,
plan->plancache_list)
3280 newplan->
saved =
true;
3319 if (enr == NULL || enr->
md.
name == NULL)
List * raw_parser(const char *str, RawParseMode mode)
static bool Nulls[MAXATTR]
#define InvalidSubTransactionId
void InitializeQueryCompletion(QueryCompletion *qc)
const char * GetCommandTagName(CommandTag commandTag)
Datum datumTransfer(Datum value, bool typByVal, int typLen)
DestReceiver * CreateDestReceiver(CommandDest dest)
DestReceiver * None_Receiver
int internalerrquery(const char *query)
int internalerrposition(int cursorpos)
int errdetail(const char *fmt,...)
ErrorContextCallback * error_context_stack
void ReThrowError(ErrorData *edata)
ErrorData * CopyErrorData(void)
void FlushErrorState(void)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
int errposition(int cursorpos)
#define ereport(elevel,...)
bool ExecSupportsBackwardScan(Plan *node)
bool ExecutorStart(QueryDesc *queryDesc, int eflags)
void ExecutorStartCachedPlan(QueryDesc *queryDesc, int eflags, CachedPlanSource *plansource, int query_index)
void ExecutorEnd(QueryDesc *queryDesc)
void ExecutorFinish(QueryDesc *queryDesc)
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
#define EXEC_FLAG_SKIP_TRIGGERS
char * OidOutputFunctionCall(Oid functionId, Datum val)
#define DatumGetHeapTupleHeader(X)
Assert(PointerIsAligned(start, uint64))
const FormData_pg_attribute * SystemAttributeByName(const char *attname)
const FormData_pg_attribute * SystemAttributeDefinition(AttrNumber attno)
HeapTuple heap_copytuple(HeapTuple tuple)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static void * GETSTRUCT(const HeapTupleData *tuple)
static void slist_delete_current(slist_mutable_iter *iter)
#define slist_foreach_modify(iter, lhead)
static void slist_init(slist_head *head)
static void slist_push_head(slist_head *head, slist_node *node)
#define slist_container(type, membername, ptr)
if(TABLE==NULL||TABLE_index==NULL)
List * lappend(List *list, void *datum)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
char * get_namespace_name(Oid nspid)
char * MemoryContextStrdup(MemoryContext context, const char *string)
void * MemoryContextAlloc(MemoryContext context, Size size)
void MemoryContextReset(MemoryContext context)
MemoryContext TopTransactionContext
char * pstrdup(const char *in)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
MemoryContext CacheMemoryContext
void MemoryContextDelete(MemoryContext context)
void * repalloc_huge(void *pointer, Size size)
MemoryContext PortalContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define ALLOCSET_SMALL_SIZES
int namestrcmp(Name name, const char *str)
#define IsA(nodeptr, _type_)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
ParamListInfo makeParamList(int numParams)
ParamListInfo copyParamList(ParamListInfo from)
void(* ParserSetupHook)(struct ParseState *pstate, void *arg)
#define CURSOR_OPT_SCROLL
#define CURSOR_OPT_PARALLEL_OK
#define CURSOR_OPT_NO_SCROLL
@ RAW_PARSE_PLPGSQL_ASSIGN2
@ RAW_PARSE_PLPGSQL_ASSIGN1
@ RAW_PARSE_PLPGSQL_ASSIGN3
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
FormData_pg_type * Form_pg_type
void CachedPlanSetParentContext(CachedPlanSource *plansource, MemoryContext newcontext)
bool CachedPlanIsValid(CachedPlanSource *plansource)
void DropCachedPlan(CachedPlanSource *plansource)
void SaveCachedPlan(CachedPlanSource *plansource)
void CompleteCachedPlan(CachedPlanSource *plansource, List *querytree_list, MemoryContext querytree_context, Oid *param_types, int num_params, ParserSetupHook parserSetup, void *parserSetupArg, int cursor_options, bool fixed_result)
CachedPlan * GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams, ResourceOwner owner, QueryEnvironment *queryEnv)
CachedPlanSource * CreateOneShotCachedPlan(RawStmt *raw_parse_tree, const char *query_string, CommandTag commandTag)
CachedPlanSource * CreateCachedPlan(RawStmt *raw_parse_tree, const char *query_string, CommandTag commandTag)
CachedPlanSource * CopyCachedPlan(CachedPlanSource *plansource)
void ReleaseCachedPlan(CachedPlan *plan, ResourceOwner owner)
void PortalDefineQuery(Portal portal, const char *prepStmtName, const char *sourceText, CommandTag commandTag, List *stmts, CachedPlan *cplan, CachedPlanSource *plansource)
Portal CreateNewPortal(void)
void HoldPinnedPortals(void)
void PortalDrop(Portal portal, bool isTopCommit)
Portal GetPortalByName(const char *name)
Portal CreatePortal(const char *name, bool allowDup, bool dupSilent)
void ForgetPortalSnapshots(void)
List * pg_analyze_and_rewrite_withcb(RawStmt *parsetree, const char *query_string, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
List * pg_analyze_and_rewrite_fixedparams(RawStmt *parsetree, const char *query_string, const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv)
void ShowUsage(const char *title)
static Datum ObjectIdGetDatum(Oid X)
void FreeQueryDesc(QueryDesc *qdesc)
bool PlannedStmtRequiresSnapshot(PlannedStmt *pstmt)
void EnsurePortalSnapshotExists(void)
void PortalStart(Portal portal, ParamListInfo params, int eflags, Snapshot snapshot)
uint64 PortalRunFetch(Portal portal, FetchDirection fdirection, long count, DestReceiver *dest)
QueryDesc * CreateQueryDesc(PlannedStmt *plannedstmt, CachedPlan *cplan, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, QueryEnvironment *queryEnv, int instrument_options)
EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name)
void unregister_ENR(QueryEnvironment *queryEnv, const char *name)
QueryEnvironment * create_queryEnv(void)
void register_ENR(QueryEnvironment *queryEnv, EphemeralNamedRelation enr)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
ResourceOwner CurrentResourceOwner
Snapshot GetTransactionSnapshot(void)
void PushActiveSnapshot(Snapshot snapshot)
void UpdateActiveSnapshotCommandId(void)
bool ActiveSnapshotSet(void)
void PopActiveSnapshot(void)
void PushCopiedSnapshot(Snapshot snapshot)
Snapshot GetActiveSnapshot(void)
void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid)
List * SPI_plan_get_plan_sources(SPIPlanPtr plan)
SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, int cursorOptions)
static int _SPI_execute_plan(SPIPlanPtr plan, const SPIExecuteOptions *options, Snapshot snapshot, Snapshot crosscheck_snapshot, bool fire_triggers)
int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, ParamListInfo params, bool read_only, long tcount)
bool spi_printtup(TupleTableSlot *slot, DestReceiver *self)
static void _SPI_error_callback(void *arg)
static int _SPI_connected
void SPI_scroll_cursor_move(Portal portal, FetchDirection direction, long count)
static SPIPlanPtr _SPI_save_plan(SPIPlanPtr plan)
void SPI_cursor_move(Portal portal, bool forward, long count)
void SPI_freetuple(HeapTuple tuple)
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
void spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
static int _SPI_end_call(bool use_exec)
bool SPI_plan_is_valid(SPIPlanPtr plan)
void SPI_commit_and_chain(void)
bool SPI_is_cursor_plan(SPIPlanPtr plan)
char * SPI_gettype(TupleDesc tupdesc, int fnumber)
void * SPI_repalloc(void *pointer, Size size)
SPIPlanPtr SPI_prepare_extended(const char *src, const SPIPrepareOptions *options)
Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber)
static _SPI_connection * _SPI_stack
HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc)
int SPI_freeplan(SPIPlanPtr plan)
const char * SPI_result_code_string(int code)
void SPI_rollback_and_chain(void)
SPITupleTable * SPI_tuptable
Portal SPI_cursor_find(const char *name)
int SPI_unregister_relation(const char *name)
bool SPI_inside_nonatomic_context(void)
static void _SPI_cursor_operation(Portal portal, FetchDirection direction, long count, DestReceiver *dest)
int SPI_execute_snapshot(SPIPlanPtr plan, Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, bool read_only, bool fire_triggers, long tcount)
int SPI_execute_plan_extended(SPIPlanPtr plan, const SPIExecuteOptions *options)
SPIPlanPtr SPI_prepare_params(const char *src, ParserSetupHook parserSetup, void *parserSetupArg, int cursorOptions)
SPIPlanPtr SPI_saveplan(SPIPlanPtr plan)
void SPI_cursor_fetch(Portal portal, bool forward, long count)
Portal SPI_cursor_parse_open(const char *name, const char *src, const SPIParseOpenOptions *options)
int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only, long tcount)
static _SPI_connection * _SPI_current
Datum SPI_datumTransfer(Datum value, bool typByVal, int typLen)
CachedPlan * SPI_plan_get_cached_plan(SPIPlanPtr plan)
int SPI_register_trigger_data(TriggerData *tdata)
static int _SPI_stack_depth
static void _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan, ParamListInfo params, bool read_only)
Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, Datum *Values, const char *Nulls, bool read_only, int cursorOptions)
void SPI_freetuptable(SPITupleTable *tuptable)
Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only)
int SPI_exec(const char *src, long tcount)
static int _SPI_begin_call(bool use_exec)
static ParamListInfo _SPI_convert_params(int nargs, Oid *argtypes, Datum *Values, const char *Nulls)
int SPI_register_relation(EphemeralNamedRelation enr)
HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum, Datum *Values, const char *Nulls)
SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes)
int SPI_keepplan(SPIPlanPtr plan)
void SPI_cursor_close(Portal portal)
void SPI_pfree(void *pointer)
int SPI_connect_ext(int options)
int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, long tcount)
static void _SPI_prepare_oneshot_plan(const char *src, SPIPlanPtr plan)
char * SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
void SPI_scroll_cursor_fetch(Portal portal, FetchDirection direction, long count)
char * SPI_getnspname(Relation rel)
static void _SPI_commit(bool chain)
int SPI_execute_extended(const char *src, const SPIExecuteOptions *options)
static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, ParamListInfo paramLI, bool read_only)
static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount, CachedPlanSource *plansource, int query_index)
void * SPI_palloc(Size size)
static bool _SPI_checktuples(void)
static EphemeralNamedRelation _SPI_find_ENR_by_name(const char *name)
static MemoryContext _SPI_execmem(void)
static MemoryContext _SPI_procmem(void)
int SPI_execute_with_args(const char *src, int nargs, Oid *argtypes, Datum *Values, const char *Nulls, bool read_only, long tcount)
void SPI_start_transaction(void)
HeapTuple SPI_copytuple(HeapTuple tuple)
int SPI_getargcount(SPIPlanPtr plan)
struct SPICallbackArg SPICallbackArg
void AtEOXact_SPI(bool isCommit)
int SPI_execute(const char *src, bool read_only, long tcount)
Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
static void _SPI_rollback(bool chain)
char * SPI_getrelname(Relation rel)
char * SPI_fname(TupleDesc tupdesc, int fnumber)
Oid SPI_getargtypeid(SPIPlanPtr plan, int argIndex)
static SPIPlanPtr _SPI_make_plan_non_temp(SPIPlanPtr plan)
#define SPI_ERROR_TRANSACTION
#define SPI_ERROR_REL_NOT_FOUND
#define SPI_ERROR_REL_DUPLICATE
#define SPI_OPT_NONATOMIC
#define SPI_OK_TD_REGISTER
#define SPI_OK_REL_REGISTER
#define SPI_ERROR_OPUNKNOWN
#define SPI_OK_UPDATE_RETURNING
#define SPI_ERROR_UNCONNECTED
#define SPI_OK_REL_UNREGISTER
#define SPI_ERROR_ARGUMENT
#define SPI_ERROR_NOATTRIBUTE
#define SPI_OK_INSERT_RETURNING
#define SPI_ERROR_NOOUTFUNC
#define SPI_OK_DELETE_RETURNING
struct _SPI_plan * SPIPlanPtr
#define SPI_ERROR_TYPUNKNOWN
#define SPI_OK_MERGE_RETURNING
#define SPI_ERROR_CONNECT
struct CachedPlan * gplan
const char * query_string
struct RawStmt * raw_parse_tree
EphemeralNamedRelationMetadataData md
struct ErrorContextCallback * previous
void(* callback)(void *arg)
ParamExternData params[FLEXIBLE_ARRAY_MEMBER]
QueryEnvironment * queryEnv
MemoryContext portalContext
PlannedStmt * plannedstmt
Tuplestorestate * tg_oldtable
Tuplestorestate * tg_newtable
SubTransactionId connectSubid
SPITupleTable * outer_tuptable
QueryEnvironment * queryEnv
SubTransactionId execSubid
ParserSetupHook parserSetup
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
int64 tuplestore_tuple_count(Tuplestorestate *state)
static HeapTuple ExecCopySlotHeapTuple(TupleTableSlot *slot)
void assign_record_type_typmod(TupleDesc tupDesc)
void ProcessUtility(PlannedStmt *pstmt, const char *queryString, bool readOnlyTree, ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, QueryCompletion *qc)
bool CommandIsReadOnly(PlannedStmt *pstmt)
CommandTag CreateCommandTag(Node *parsetree)
static const char * CreateCommandName(Node *parsetree)
@ PROCESS_UTILITY_QUERY_NONATOMIC
void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s)
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
SubTransactionId GetCurrentSubTransactionId(void)
void CommandCounterIncrement(void)
void StartTransactionCommand(void)
bool IsSubTransaction(void)
void CommitTransactionCommand(void)
void AbortCurrentTransaction(void)