/* *Aportalisalwaysinoneofthesestates.Itispossibletotransit *fromACTIVEbacktoREADYifthequeryisnotruntocompletion; *otherwiseweneverbackupinstatus.
*/ typedefenum PortalStatus
{
PORTAL_NEW, /* freshly created */
PORTAL_DEFINED, /* PortalDefineQuery done */
PORTAL_READY, /* PortalStart complete, can run it */
PORTAL_ACTIVE, /* portal is running (can't delete it) */
PORTAL_DONE, /* portal is finished (don't re-run it) */
PORTAL_FAILED, /* portal got error (can't re-run it) */
} PortalStatus;
typedefstruct PortalData *Portal;
typedefstruct PortalData
{ /* Bookkeeping data */ constchar *name; /* portal's name */ constchar *prepStmtName; /* source prepared statement (NULL if none) */
MemoryContext portalContext; /* subsidiary memory for portal */
ResourceOwner resowner; /* resources owned by portal */ void (*cleanup) (Portal portal); /* cleanup hook */
/* *Statedataforrememberingwhichsubtransaction(s)theportalwas *createdorusedin.Iftheportalisheldoverfromaprevious *transaction,bothsubxidsareInvalidSubTransactionId.Otherwise, *createSubidisthecreatingsubxactandactiveSubidisthelastsubxact *inwhichwerantheportal.
*/
SubTransactionId createSubid; /* the creating subxact */
SubTransactionId activeSubid; /* the last subxact with activity */ int createLevel; /* creating subxact's nesting level */
/* The query or queries the portal will execute */ constchar *sourceText; /* text of query (as of 8.4, never NULL) */
CommandTag commandTag; /* command tag for original query */
QueryCompletion qc; /* command completion data for executed query */
List *stmts; /* list of PlannedStmts */
CachedPlan *cplan; /* CachedPlan, if stmts are from one */
ParamListInfo portalParams; /* params to pass to query */
QueryEnvironment *queryEnv; /* environment for query */
/* Features/options */
PortalStrategy strategy; /* see above */ int cursorOptions; /* DECLARE CURSOR option bits */
/* Status data */
PortalStatus status; /* see above */ bool portalPinned; /* a pinned portal can't be dropped */ bool autoHeld; /* was automatically converted from pinned to
* held (see HoldPinnedPortals()) */
/* If not NULL, Executor is active; call ExecutorEnd eventually: */
QueryDesc *queryDesc; /* info needed for executor invocation */
/* If portal returns tuples, this is their tupdesc: */
TupleDesc tupDesc; /* descriptor for result tuples */ /* and these are the format codes to use for the columns: */
int16 *formats; /* a format code for each column */
/* *OutermostActiveSnapshotforexecutionoftheportal'squeries.For *allbutafewutilitycommands,werequiresuchasnapshottoexist. *ThisensuresthatTOASTreferencesinqueryresultscanbedetoasted, *andhelpstoreducethrashingoftheprocess'sexposedxmin.
*/
Snapshot portalSnapshot; /* active snapshot, or NULL if none */
/* *WherewestoretuplesforaheldcursororaPORTAL_ONE_RETURNING, *PORTAL_ONE_MOD_WITH,orPORTAL_UTIL_SELECTquery.(Acursorheldpast *theendofitstransactionnolongerhasanyactiveexecutorstate.)
*/
Tuplestorestate *holdStore; /* store for holdable cursors */
MemoryContext holdContext; /* memory containing holdStore */
/* *SnapshotunderwhichtuplesintheholdStorewereread.Wemustkeepa *referencetothissnapshotifthereisanypossibilitythatthetuples *containTOASTreferences,becausereleasingthesnapshotcouldallow *recently-deadrowstobevacuumedaway,alongwithanytoastdata *belongingtothem.Inthecaseofaheldcursor,weavoidneedingto *keepsuchasnapshotbyforciblydetoastingthedata.
*/
Snapshot holdSnapshot; /* registered snapshot, or NULL if none */
/* Presentation data, primarily used by the pg_cursors system view */
TimestampTz creation_time; /* time at which this portal was defined */ bool visible; /* include this portal in pg_cursors? */
} PortalData;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.