PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, QueryEnvironment *queryEnv, int instrument_options)
 
void FreeQueryDesc (QueryDesc *qdesc)
 

Typedef Documentation

◆ QueryDesc

Function Documentation

◆ CreateQueryDesc()

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

Definition at line 68 of file pquery.c.

76{
78
79 qd->operation = plannedstmt->commandType; /* operation */
80 qd->plannedstmt = plannedstmt; /* plan */
81 qd->sourceText = sourceText; /* query text */
82 qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
83 /* RI check snapshot */
84 qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot);
85 qd->dest = dest; /* output dest */
86 qd->params = params; /* parameter values passed into query */
87 qd->queryEnv = queryEnv;
88 qd->instrument_options = instrument_options; /* instrumentation wanted? */
89 qd->query_instr_options = 0;
90
91 /* null these fields until set by ExecutorStart */
92 qd->tupDesc = NULL;
93 qd->estate = NULL;
94 qd->planstate = NULL;
95 qd->query_instr = NULL;
96
97 /* not yet executed */
98 qd->already_executed = false;
99
100 return qd;
101}
#define palloc_object(type)
Definition fe_memutils.h:74
static int fb(int x)
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition snapmgr.c:824
CmdType commandType
Definition plannodes.h:66
const char * sourceText
Definition execdesc.h:38
ParamListInfo params
Definition execdesc.h:42
DestReceiver * dest
Definition execdesc.h:41
int instrument_options
Definition execdesc.h:44
EState * estate
Definition execdesc.h:50
CmdType operation
Definition execdesc.h:36
Snapshot snapshot
Definition execdesc.h:39
bool already_executed
Definition execdesc.h:54
PlannedStmt * plannedstmt
Definition execdesc.h:37
int query_instr_options
Definition execdesc.h:45
QueryEnvironment * queryEnv
Definition execdesc.h:43
struct Instrumentation * query_instr
Definition execdesc.h:57
TupleDesc tupDesc
Definition execdesc.h:49
Snapshot crosscheck_snapshot
Definition execdesc.h:40
PlanState * planstate
Definition execdesc.h:51

References QueryDesc::already_executed, PlannedStmt::commandType, QueryDesc::crosscheck_snapshot, QueryDesc::dest, QueryDesc::estate, fb(), QueryDesc::instrument_options, QueryDesc::operation, palloc_object, QueryDesc::params, QueryDesc::plannedstmt, QueryDesc::planstate, QueryDesc::query_instr, QueryDesc::query_instr_options, QueryDesc::queryEnv, RegisterSnapshot(), QueryDesc::snapshot, QueryDesc::sourceText, 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)
extern

Definition at line 107 of file pquery.c.

108{
109 /* Can't be a live query */
110 Assert(qdesc->estate == NULL);
111
112 /* forget our snapshots */
113 UnregisterSnapshot(qdesc->snapshot);
114 UnregisterSnapshot(qdesc->crosscheck_snapshot);
115
116 /* Only the QueryDesc itself need be freed */
117 pfree(qdesc);
118}
#define Assert(condition)
Definition c.h:943
void pfree(void *pointer)
Definition mcxt.c:1616
void UnregisterSnapshot(Snapshot snapshot)
Definition snapmgr.c:866

References Assert, fb(), pfree(), and UnregisterSnapshot().

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