#include "nodes/execnodes.h"
#include "tcop/dest.h"
Go to the source code of this file.
Data Structures | |
struct | QueryDesc |
Typedefs | |
typedef struct QueryDesc | QueryDesc |
Functions | |
QueryDesc * | CreateQueryDesc (PlannedStmt *plannedstmt, const char *sourceText, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, ParamListInfo params, int instrument_options) |
QueryDesc * | CreateUtilityQueryDesc (Node *utilitystmt, const char *sourceText, Snapshot snapshot, DestReceiver *dest, ParamListInfo params) |
void | FreeQueryDesc (QueryDesc *qdesc) |
QueryDesc* CreateQueryDesc | ( | PlannedStmt * | plannedstmt, | |
const char * | sourceText, | |||
Snapshot | snapshot, | |||
Snapshot | crosscheck_snapshot, | |||
DestReceiver * | dest, | |||
ParamListInfo | params, | |||
int | instrument_options | |||
) |
Definition at line 62 of file pquery.c.
References PlannedStmt::commandType, QueryDesc::crosscheck_snapshot, QueryDesc::dest, QueryDesc::estate, QueryDesc::instrument_options, QueryDesc::operation, palloc(), QueryDesc::params, QueryDesc::plannedstmt, QueryDesc::planstate, RegisterSnapshot(), QueryDesc::snapshot, QueryDesc::sourceText, QueryDesc::totaltime, QueryDesc::tupDesc, PlannedStmt::utilityStmt, and QueryDesc::utilitystmt.
Referenced by _SPI_execute_plan(), BeginCopy(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), PortalStart(), postquel_start(), ProcessQuery(), and refresh_matview_datafill().
{ QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); qd->operation = plannedstmt->commandType; /* operation */ qd->plannedstmt = plannedstmt; /* plan */ qd->utilitystmt = plannedstmt->utilityStmt; /* in case DECLARE CURSOR */ qd->sourceText = sourceText; /* query text */ qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ /* RI check snapshot */ qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot); qd->dest = dest; /* output dest */ qd->params = params; /* parameter values passed into query */ qd->instrument_options = instrument_options; /* instrumentation * wanted? */ /* null these fields until set by ExecutorStart */ qd->tupDesc = NULL; qd->estate = NULL; qd->planstate = NULL; qd->totaltime = NULL; return qd; }
QueryDesc* CreateUtilityQueryDesc | ( | Node * | utilitystmt, | |
const char * | sourceText, | |||
Snapshot | snapshot, | |||
DestReceiver * | dest, | |||
ParamListInfo | params | |||
) |
Definition at line 97 of file pquery.c.
References QueryDesc::crosscheck_snapshot, QueryDesc::dest, QueryDesc::estate, QueryDesc::instrument_options, QueryDesc::operation, palloc(), QueryDesc::params, QueryDesc::plannedstmt, QueryDesc::planstate, RegisterSnapshot(), QueryDesc::snapshot, QueryDesc::sourceText, QueryDesc::totaltime, QueryDesc::tupDesc, and QueryDesc::utilitystmt.
Referenced by postquel_start().
{ QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); qd->operation = CMD_UTILITY; /* operation */ qd->plannedstmt = NULL; qd->utilitystmt = utilitystmt; /* utility command */ qd->sourceText = sourceText; /* query text */ qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ qd->crosscheck_snapshot = InvalidSnapshot; /* RI check snapshot */ qd->dest = dest; /* output dest */ qd->params = params; /* parameter values passed into query */ qd->instrument_options = false; /* uninteresting for utilities */ /* null these fields until set by ExecutorStart */ qd->tupDesc = NULL; qd->estate = NULL; qd->planstate = NULL; qd->totaltime = NULL; return qd; }
void FreeQueryDesc | ( | QueryDesc * | qdesc | ) |
Definition at line 128 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(), PersistHoldablePortal(), PortalCleanup(), postquel_end(), ProcessQuery(), and refresh_matview_datafill().
{ /* Can't be a live query */ Assert(qdesc->estate == NULL); /* forget our snapshots */ UnregisterSnapshot(qdesc->snapshot); UnregisterSnapshot(qdesc->crosscheck_snapshot); /* Only the QueryDesc itself need be freed */ pfree(qdesc); }