PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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, int instrument_options)
 
void FreeQueryDesc (QueryDesc *qdesc)
 

Typedef Documentation

Function Documentation

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

Definition at line 66 of file pquery.c.

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

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

73 {
74  QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc));
75 
76  qd->operation = plannedstmt->commandType; /* operation */
77  qd->plannedstmt = plannedstmt; /* plan */
78  qd->sourceText = sourceText; /* query text */
79  qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
80  /* RI check snapshot */
81  qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot);
82  qd->dest = dest; /* output dest */
83  qd->params = params; /* parameter values passed into query */
84  qd->instrument_options = instrument_options; /* instrumentation
85  * wanted? */
86 
87  /* null these fields until set by ExecutorStart */
88  qd->tupDesc = NULL;
89  qd->estate = NULL;
90  qd->planstate = NULL;
91  qd->totaltime = NULL;
92 
93  /* not yet executed */
94  qd->already_executed = false;
95 
96  return qd;
97 }
EState * estate
Definition: execdesc.h:47
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:858
Snapshot snapshot
Definition: execdesc.h:39
int instrument_options
Definition: execdesc.h:43
PlanState * planstate
Definition: execdesc.h:48
ParamListInfo params
Definition: execdesc.h:42
TupleDesc tupDesc
Definition: execdesc.h:46
CmdType operation
Definition: execdesc.h:36
CmdType commandType
Definition: plannodes.h:45
bool already_executed
Definition: execdesc.h:51
Snapshot crosscheck_snapshot
Definition: execdesc.h:40
struct Instrumentation * totaltime
Definition: execdesc.h:54
#define NULL
Definition: c.h:229
const char * sourceText
Definition: execdesc.h:38
DestReceiver * dest
Definition: execdesc.h:41
void * palloc(Size size)
Definition: mcxt.c:849
PlannedStmt * plannedstmt
Definition: execdesc.h:37
void FreeQueryDesc ( QueryDesc qdesc)

Definition at line 103 of file pquery.c.

References Assert, QueryDesc::crosscheck_snapshot, QueryDesc::estate, NULL, 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().

104 {
105  /* Can't be a live query */
106  Assert(qdesc->estate == NULL);
107 
108  /* forget our snapshots */
111 
112  /* Only the QueryDesc itself need be freed */
113  pfree(qdesc);
114 }
EState * estate
Definition: execdesc.h:47
Snapshot snapshot
Definition: execdesc.h:39
void pfree(void *pointer)
Definition: mcxt.c:950
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:900
Snapshot crosscheck_snapshot
Definition: execdesc.h:40
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:675