240 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
241 errmsg(
"invalid transaction termination")));
255 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
256 errmsg(
"cannot commit while a subtransaction is active")));
340 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
341 errmsg(
"invalid transaction termination")));
346 (
errcode(ERRCODE_INVALID_TRANSACTION_TERMINATION),
347 errmsg(
"cannot roll back while a subtransaction is active")));
468 if (found && isCommit)
471 errmsg(
"transaction left non-empty SPI stack"),
472 errhint(
"Check for missing \"SPI_finish\" calls.")));
528 if (found && isCommit)
531 errmsg(
"subtransaction left non-empty SPI stack"),
532 errhint(
"Check for missing \"SPI_finish\" calls.")));
558 if (tuptable->
subid >= mySubid)
602 if (src == NULL || tcount < 0)
643 if (src == NULL ||
options == NULL)
657 plan.parserSetupArg =
options->params->parserSetupArg;
673 bool read_only,
long tcount)
681 if (
plan->nargs > 0 && Values == NULL)
734 bool read_only,
long tcount)
776 bool read_only,
bool fire_triggers,
long tcount)
784 if (
plan->nargs > 0 && Values == NULL)
798 snapshot, crosscheck_snapshot,
813 int nargs,
Oid *argtypes,
815 bool read_only,
long tcount)
822 if (src == NULL || nargs < 0 || tcount < 0)
825 if (nargs > 0 && (argtypes == NULL || Values == NULL))
837 plan.argtypes = argtypes;
838 plan.parserSetup = NULL;
839 plan.parserSetupArg = NULL;
872 if (src == NULL || nargs < 0 || (nargs > 0 && argtypes == NULL))
885 plan.cursor_options = cursorOptions;
887 plan.argtypes = argtypes;
888 plan.parserSetup = NULL;
889 plan.parserSetupArg = NULL;
908 if (src == NULL ||
options == NULL)
923 plan.argtypes = NULL;
940 void *parserSetupArg,
959 plan.cursor_options = cursorOptions;
961 plan.argtypes = NULL;
962 plan.parserSetup = parserSetup;
963 plan.parserSetupArg = parserSetupArg;
992 foreach(lc,
plan->plancache_list)
1033 foreach(lc,
plan->plancache_list)
1079 if (tuple == NULL || tupdesc == NULL)
1092 if (tupdesc->
tdtypeid == RECORDOID &&
1111 int numberOfAttributes;
1116 if (rel == NULL || tuple == NULL || natts < 0 ||
attnum == NULL || Values == NULL)
1134 n = (
bool *)
palloc(numberOfAttributes *
sizeof(
bool));
1140 for (
i = 0;
i < natts;
i++)
1184 if (
namestrcmp(&attr->attname, fname) == 0 &&
1185 !attr->attisdropped)
1191 return sysatt->attnum;
1204 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1230 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1256 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1261 return (
Datum) NULL;
1276 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1312 if (fnumber > tupdesc->
natts || fnumber == 0 ||
1341 elog(
ERROR,
"SPI_palloc called while not connected to SPI");
1367 elog(
ERROR,
"SPI_datumTransfer called while not connected to SPI");
1391 if (tuptable == NULL)
1424 elog(
WARNING,
"attempt to delete invalid SPITupleTable %p", tuptable);
1474 int nargs,
Oid *argtypes,
1476 bool read_only,
int cursorOptions)
1482 if (src == NULL || nargs < 0)
1483 elog(
ERROR,
"SPI_cursor_open_with_args called with invalid arguments");
1485 if (nargs > 0 && (argtypes == NULL || Values == NULL))
1486 elog(
ERROR,
"SPI_cursor_open_with_args called with missing parameters");
1490 elog(
ERROR,
"SPI_cursor_open_with_args called while not connected");
1495 plan.cursor_options = cursorOptions;
1497 plan.argtypes = argtypes;
1498 plan.parserSetup = NULL;
1499 plan.parserSetupArg = NULL;
1540 if (src == NULL ||
options == NULL)
1541 elog(
ERROR,
"SPI_cursor_parse_open called with invalid arguments");
1545 elog(
ERROR,
"SPI_cursor_parse_open called while not connected");
1554 plan.parserSetupArg =
options->params->parserSetupArg;
1601 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
1602 errmsg(
"cannot open multi-query plan as cursor")));
1606 cmdtag =
"SELECT INTO";
1610 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
1612 errmsg(
"cannot open %s query as cursor", cmdtag)));
1620 elog(
ERROR,
"SPI_cursor_open called while not connected");
1629 if (
name == NULL ||
name[0] ==
'\0')
1649 spicallbackarg.
mode =
plan->parse_mode;
1651 spierrcontext.
arg = &spicallbackarg;
1717 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1718 errmsg(
"DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
1719 errdetail(
"Scrollable cursors must be READ ONLY.")));
1736 foreach(lc, stmt_list)
1742 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1744 errmsg(
"%s is not allowed in a non-volatile function",
1865 elog(
ERROR,
"invalid portal in SPI cursor operation");
1878 argIndex < 0 || argIndex >=
plan->nargs)
1883 return plan->argtypes[argIndex];
1954 foreach(lc,
plan->plancache_list)
1974 static char buf[64];
1979 return "SPI_ERROR_CONNECT";
1981 return "SPI_ERROR_COPY";
1983 return "SPI_ERROR_OPUNKNOWN";
1985 return "SPI_ERROR_UNCONNECTED";
1987 return "SPI_ERROR_ARGUMENT";
1989 return "SPI_ERROR_PARAM";
1991 return "SPI_ERROR_TRANSACTION";
1993 return "SPI_ERROR_NOATTRIBUTE";
1995 return "SPI_ERROR_NOOUTFUNC";
1997 return "SPI_ERROR_TYPUNKNOWN";
1999 return "SPI_ERROR_REL_DUPLICATE";
2001 return "SPI_ERROR_REL_NOT_FOUND";
2003 return "SPI_OK_CONNECT";
2005 return "SPI_OK_FINISH";
2007 return "SPI_OK_FETCH";
2009 return "SPI_OK_UTILITY";
2011 return "SPI_OK_SELECT";
2013 return "SPI_OK_SELINTO";
2015 return "SPI_OK_INSERT";
2017 return "SPI_OK_DELETE";
2019 return "SPI_OK_UPDATE";
2021 return "SPI_OK_CURSOR";
2023 return "SPI_OK_INSERT_RETURNING";
2025 return "SPI_OK_DELETE_RETURNING";
2027 return "SPI_OK_UPDATE_RETURNING";
2029 return "SPI_OK_REWRITTEN";
2031 return "SPI_OK_REL_REGISTER";
2033 return "SPI_OK_REL_UNREGISTER";
2035 return "SPI_OK_TD_REGISTER";
2037 return "SPI_OK_MERGE";
2039 return "SPI_OK_MERGE_RETURNING";
2042 sprintf(
buf,
"Unrecognized SPI code %d", code);
2060 return plan->plancache_list;
2096 spicallbackarg.
mode =
plan->parse_mode;
2098 spierrcontext.
arg = &spicallbackarg;
2130 elog(
ERROR,
"spi_dest_startup called while not connected to SPI");
2133 elog(
ERROR,
"improper call to spi_dest_startup");
2177 elog(
ERROR,
"spi_printtup called while not connected to SPI");
2180 if (tuptable == NULL)
2181 elog(
ERROR,
"improper call to spi_printtup");
2192 tuptable->
alloced = newalloced;
2223 List *raw_parsetree_list;
2224 List *plancache_list;
2232 spicallbackarg.
query = src;
2233 spicallbackarg.
mode =
plan->parse_mode;
2235 spierrcontext.
arg = &spicallbackarg;
2248 plancache_list =
NIL;
2250 foreach(list_item, raw_parsetree_list)
2268 if (
plan->parserSetup != NULL)
2274 plan->parserSetupArg,
2293 plan->parserSetupArg,
2294 plan->cursor_options,
2297 plancache_list =
lappend(plancache_list, plansource);
2300 plan->plancache_list = plancache_list;
2301 plan->oneshot =
false;
2331 List *raw_parsetree_list;
2332 List *plancache_list;
2340 spicallbackarg.
query = src;
2341 spicallbackarg.
mode =
plan->parse_mode;
2343 spierrcontext.
arg = &spicallbackarg;
2355 plancache_list =
NIL;
2357 foreach(list_item, raw_parsetree_list)
2366 plancache_list =
lappend(plancache_list, plansource);
2369 plan->plancache_list = plancache_list;
2370 plan->oneshot =
true;
2407 bool allow_nonatomic;
2408 bool pushed_active_snap =
false;
2421 allow_nonatomic =
options->allow_nonatomic &&
2427 spicallbackarg.
query = NULL;
2428 spicallbackarg.
mode =
plan->parse_mode;
2430 spierrcontext.
arg = &spicallbackarg;
2468 pushed_active_snap =
true;
2474 pushed_active_snap =
true;
2484 else if (plan_owner == NULL)
2495 (
errcode(ERRCODE_SYNTAX_ERROR),
2496 errmsg(
"empty query does not return tuples")));
2498 foreach(lc1,
plan->plancache_list)
2513 List *querytree_list;
2519 if (parsetree == NULL)
2520 querytree_list =
NIL;
2521 else if (
plan->parserSetup != NULL)
2527 plan->parserSetupArg,
2546 plan->parserSetupArg,
2547 plan->cursor_options,
2564 cmdtag =
"SELECT INTO";
2568 (
errcode(ERRCODE_SYNTAX_ERROR),
2570 errmsg(
"%s query does not return tuples", cmdtag)));
2609 if (!
options->read_only && !allow_nonatomic)
2611 if (pushed_active_snap)
2614 pushed_active_snap =
true;
2618 foreach(lc2, stmt_list)
2621 bool canSetTag =
stmt->canSetTag;
2634 if (
stmt->utilityStmt)
2655 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2657 errmsg(
"%s is not allowed in a non-volatile function",
2665 if (!
options->read_only && pushed_active_snap)
2682 if (
stmt->utilityStmt == NULL)
2694 snap, crosscheck_snapshot,
2700 canSetTag ?
options->tcount : 0);
2712 if (allow_nonatomic)
2815 if (pushed_active_snap)
2858 for (
int i = 0;
i < nargs;
i++)
2865 prm->
ptype = argtypes[
i];
2919#ifdef SPI_EXECUTOR_STATS
2920 if (ShowExecutorStats)
2940 elog(
ERROR,
"consistency check on SPI tuple count failed");
2947#ifdef SPI_EXECUTOR_STATS
2948 if (ShowExecutorStats)
2964 const char *query = carg->
query;
2965 int syntaxerrposition;
2975 if (syntaxerrposition > 0)
2987 errcontext(
"PL/pgSQL expression \"%s\"", query);
2992 errcontext(
"PL/pgSQL assignment \"%s\"", query);
3014 elog(
ERROR,
"invalid portal in SPI cursor operation");
3018 elog(
ERROR,
"SPI cursor operation called while not connected");
3043 elog(
ERROR,
"consistency check on SPI tuple count failed");
3121 bool failed =
false;
3123 if (tuptable == NULL)
3125 else if (processed != tuptable->
numvals)
3171 if (
plan->nargs > 0)
3187 foreach(lc,
plan->plancache_list)
3236 if (
plan->nargs > 0)
3247 foreach(lc,
plan->plancache_list)
3263 newplan->
saved =
true;
3302 if (enr == NULL || enr->
md.
name == NULL)
List * raw_parser(const char *str, RawParseMode mode)
static bool Nulls[MAXATTR]
#define InvalidSubTransactionId
#define Assert(condition)
void InitializeQueryCompletion(QueryCompletion *qc)
const char * GetCommandTagName(CommandTag commandTag)
Datum datumTransfer(Datum value, bool typByVal, int typLen)
static void PGresult * res
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)
void ExecutorEnd(QueryDesc *queryDesc)
void ExecutorFinish(QueryDesc *queryDesc)
void ExecutorStart(QueryDesc *queryDesc, int eflags)
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
#define EXEC_FLAG_SKIP_TRIGGERS
char * OidOutputFunctionCall(Oid functionId, Datum val)
#define DatumGetHeapTupleHeader(X)
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 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_)
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)
Portal CreateNewPortal(void)
void HoldPinnedPortals(void)
void PortalDrop(Portal portal, bool isTopCommit)
Portal GetPortalByName(const char *name)
void PortalDefineQuery(Portal portal, const char *prepStmtName, const char *sourceText, CommandTag commandTag, List *stmts, CachedPlan *cplan)
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)
QueryDesc * CreateQueryDesc(PlannedStmt *plannedstmt, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, QueryEnvironment *queryEnv, int instrument_options)
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)
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)
MemoryContextSwitchTo(old_ctx)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
ResourceOwner CurrentResourceOwner
static pg_noinline void Size size
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
static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, uint64 tcount)
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)
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)