PostgreSQL Source Code git master
execdesc.h File Reference
#include "nodes/execnodes.h"
#include "tcop/dest.h"
Include dependency graph for execdesc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  QueryDesc
 

Typedefs

typedef struct QueryDesc QueryDesc
 

Functions

QueryDescCreateQueryDesc (PlannedStmt *plannedstmt, CachedPlan *cplan, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, QueryEnvironment *queryEnv, int instrument_options)
 
void FreeQueryDesc (QueryDesc *qdesc)
 

Typedef Documentation

◆ QueryDesc

typedef struct QueryDesc QueryDesc

Function Documentation

◆ CreateQueryDesc()

QueryDesc * CreateQueryDesc ( PlannedStmt plannedstmt,
CachedPlan cplan,
const char *  sourceText,
Snapshot  snapshot,
Snapshot  crosscheck_snapshot,
DestReceiver dest,
ParamListInfo  params,
QueryEnvironment queryEnv,
int  instrument_options 
)

Definition at line 72 of file pquery.c.

81{
82 QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc));
83
84 qd->operation = plannedstmt->commandType; /* operation */
85 qd->plannedstmt = plannedstmt; /* plan */
86 qd->cplan = cplan; /* CachedPlan supplying the plannedstmt */
87 qd->sourceText = sourceText; /* query text */
88 qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
89 /* RI check snapshot */
90 qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot);
91 qd->dest = dest; /* output dest */
92 qd->params = params; /* parameter values passed into query */
93 qd->queryEnv = queryEnv;
94 qd->instrument_options = instrument_options; /* instrumentation wanted? */
95
96 /* null these fields until set by ExecutorStart */
97 qd->tupDesc = NULL;
98 qd->estate = NULL;
99 qd->planstate = NULL;
100 qd->totaltime = NULL;
101
102 /* not yet executed */
103 qd->already_executed = false;
104
105 return qd;
106}
void * palloc(Size size)
Definition: mcxt.c:1317
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:811
CmdType commandType
Definition: plannodes.h:53
const char * sourceText
Definition: execdesc.h:39
ParamListInfo params
Definition: execdesc.h:43
DestReceiver * dest
Definition: execdesc.h:42
int instrument_options
Definition: execdesc.h:45
EState * estate
Definition: execdesc.h:49
CachedPlan * cplan
Definition: execdesc.h:38
CmdType operation
Definition: execdesc.h:36
Snapshot snapshot
Definition: execdesc.h:40
bool already_executed
Definition: execdesc.h:53
PlannedStmt * plannedstmt
Definition: execdesc.h:37
struct Instrumentation * totaltime
Definition: execdesc.h:56
QueryEnvironment * queryEnv
Definition: execdesc.h:44
TupleDesc tupDesc
Definition: execdesc.h:48
Snapshot crosscheck_snapshot
Definition: execdesc.h:41
PlanState * planstate
Definition: execdesc.h:50

References QueryDesc::already_executed, PlannedStmt::commandType, QueryDesc::cplan, QueryDesc::crosscheck_snapshot, generate_unaccent_rules::dest, QueryDesc::dest, QueryDesc::estate, QueryDesc::instrument_options, QueryDesc::operation, palloc(), QueryDesc::params, QueryDesc::plannedstmt, QueryDesc::planstate, QueryDesc::queryEnv, RegisterSnapshot(), QueryDesc::snapshot, QueryDesc::sourceText, QueryDesc::totaltime, and QueryDesc::tupDesc.

Referenced by _SPI_execute_plan(), BeginCopyTo(), ExecCreateTableAs(), ExecParallelGetQueryDesc(), execute_sql_string(), ExplainOnePlan(), PortalStart(), postquel_start(), ProcessQuery(), and refresh_matview_datafill().

◆ FreeQueryDesc()

void FreeQueryDesc ( QueryDesc qdesc)

Definition at line 112 of file pquery.c.

113{
114 /* Can't be a live query */
115 Assert(qdesc->estate == NULL);
116
117 /* forget our snapshots */
120
121 /* Only the QueryDesc itself need be freed */
122 pfree(qdesc);
123}
Assert(PointerIsAligned(start, uint64))
void pfree(void *pointer)
Definition: mcxt.c:1524
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:853

References Assert(), QueryDesc::crosscheck_snapshot, QueryDesc::estate, pfree(), QueryDesc::snapshot, and UnregisterSnapshot().

Referenced by _SPI_execute_plan(), EndCopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PersistHoldablePortal(), PortalCleanup(), postquel_end(), ProcessQuery(), and refresh_matview_datafill().