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 64 of file pquery.c.

References 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().

71 {
72  QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc));
73 
74  qd->operation = plannedstmt->commandType; /* operation */
75  qd->plannedstmt = plannedstmt; /* plan */
76  qd->sourceText = sourceText; /* query text */
77  qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
78  /* RI check snapshot */
79  qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot);
80  qd->dest = dest; /* output dest */
81  qd->params = params; /* parameter values passed into query */
82  qd->instrument_options = instrument_options; /* instrumentation
83  * wanted? */
84 
85  /* null these fields until set by ExecutorStart */
86  qd->tupDesc = NULL;
87  qd->estate = NULL;
88  qd->planstate = NULL;
89  qd->totaltime = NULL;
90 
91  return qd;
92 }
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
Snapshot crosscheck_snapshot
Definition: execdesc.h:40
struct Instrumentation * totaltime
Definition: execdesc.h:51
#define NULL
Definition: c.h:226
const char * sourceText
Definition: execdesc.h:38
DestReceiver * dest
Definition: execdesc.h:41
void * palloc(Size size)
Definition: mcxt.c:891
PlannedStmt * plannedstmt
Definition: execdesc.h:37
void FreeQueryDesc ( QueryDesc qdesc)

Definition at line 98 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().

99 {
100  /* Can't be a live query */
101  Assert(qdesc->estate == NULL);
102 
103  /* forget our snapshots */
106 
107  /* Only the QueryDesc itself need be freed */
108  pfree(qdesc);
109 }
EState * estate
Definition: execdesc.h:47
Snapshot snapshot
Definition: execdesc.h:39
void pfree(void *pointer)
Definition: mcxt.c:992
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:900
Snapshot crosscheck_snapshot
Definition: execdesc.h:40
#define NULL
Definition: c.h:226
#define Assert(condition)
Definition: c.h:671