62 (
errcode(ERRCODE_INVALID_CURSOR_NAME),
63 errmsg(
"invalid cursor name: must not be empty")));
74 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
75 errmsg(
"cannot create a cursor WITH HOLD within security-restricted operation")));
82 (*post_parse_analyze_hook) (pstate, query, jstate);
94 elog(
ERROR,
"non-SELECT statement in DECLARE CURSOR");
99 elog(
ERROR,
"non-SELECT statement in DECLARE CURSOR");
188 if (!
stmt->portalname ||
stmt->portalname[0] ==
'\0')
190 (
errcode(ERRCODE_INVALID_CURSOR_NAME),
191 errmsg(
"invalid cursor name: must not be empty")));
198 (
errcode(ERRCODE_UNDEFINED_CURSOR),
199 errmsg(
"cursor \"%s\" does not exist",
stmt->portalname)));
241 (
errcode(ERRCODE_INVALID_CURSOR_NAME),
242 errmsg(
"invalid cursor name: must not be empty")));
251 (
errcode(ERRCODE_UNDEFINED_CURSOR),
252 errmsg(
"cursor \"%s\" does not exist",
name)));
339 Assert(queryDesc != NULL);
433 queryDesc->
dest = NULL;
470 elog(
ERROR,
"unexpected end of tuple stream");
#define InvalidSubTransactionId
#define Assert(condition)
static void SetQueryCompletion(QueryCompletion *qc, CommandTag commandTag, uint64 nprocessed)
DestReceiver * None_Receiver
DestReceiver * CreateDestReceiver(CommandDest dest)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool ExecSupportsBackwardScan(Plan *node)
void ExecutorEnd(QueryDesc *queryDesc)
void ExecutorFinish(QueryDesc *queryDesc)
void ExecutorRewind(QueryDesc *queryDesc)
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
char * pstrdup(const char *in)
void MemoryContextDeleteChildren(MemoryContext context)
MemoryContext PortalContext
bool InSecurityRestrictedOperation(void)
#define castNode(_type_, nodeptr)
ParamListInfo copyParamList(ParamListInfo from)
#define CURSOR_OPT_SCROLL
#define CURSOR_OPT_NO_SCROLL
post_parse_analyze_hook_type post_parse_analyze_hook
static int list_length(const List *l)
#define linitial_node(type, l)
void PerformCursorOpen(ParseState *pstate, DeclareCursorStmt *cstmt, ParamListInfo params, bool isTopLevel)
void PerformPortalClose(const char *name)
void PortalCleanup(Portal portal)
void PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest, QueryCompletion *qc)
void PersistHoldablePortal(Portal portal)
void MarkPortalFailed(Portal portal)
void MarkPortalActive(Portal portal)
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)
void PortalHashTableDeleteAll(void)
Portal CreatePortal(const char *name, bool allowDup, bool dupSilent)
PlannedStmt * pg_plan_query(Query *querytree, const char *query_string, int cursorOptions, ParamListInfo boundParams)
void FreeQueryDesc(QueryDesc *qdesc)
void PortalStart(Portal portal, ParamListInfo params, int eflags, Snapshot snapshot)
uint64 PortalRunFetch(Portal portal, FetchDirection fdirection, long count, DestReceiver *dest)
static bool IsQueryIdEnabled(void)
JumbleState * JumbleQuery(Query *query)
MemoryContextSwitchTo(old_ctx)
ResourceOwner CurrentResourceOwner
List * QueryRewrite(Query *parsetree)
@ NoMovementScanDirection
void PushActiveSnapshot(Snapshot snapshot)
void PopActiveSnapshot(void)
Snapshot GetActiveSnapshot(void)
const char * p_sourcetext
SubTransactionId createSubid
MemoryContext holdContext
MemoryContext portalContext
Tuplestorestate * holdStore
void(* cleanup)(Portal portal)
void(* rDestroy)(DestReceiver *self)
void SetTuplestoreDestReceiverParams(DestReceiver *self, Tuplestorestate *tStore, MemoryContext tContext, bool detoast, TupleDesc target_tupdesc, const char *map_failure_msg)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
void tuplestore_rescan(Tuplestorestate *state)
bool tuplestore_skiptuples(Tuplestorestate *state, int64 ntuples, bool forward)
void RequireTransactionBlock(bool isTopLevel, const char *stmtType)