* CreateQueryDesc * * N.B. If sliceTable is non-NULL in the top node of plantree, then * nMotionNodes and nParamExec must be set correctly, as well, and * the QueryDesc will be arranged so that ExecutorStart and ExecutorRun * will handle plan slicing. */
| 87 | * will handle plan slicing. |
| 88 | */ |
| 89 | QueryDesc * |
| 90 | CreateQueryDesc(PlannedStmt *plannedstmt, |
| 91 | const char *sourceText, |
| 92 | Snapshot snapshot, |
| 93 | Snapshot crosscheck_snapshot, |
| 94 | DestReceiver *dest, |
| 95 | ParamListInfo params, |
| 96 | QueryEnvironment *queryEnv, |
| 97 | int instrument_options) |
| 98 | { |
| 99 | QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); |
| 100 | |
| 101 | qd->operation = plannedstmt->commandType; /* operation */ |
| 102 | qd->plannedstmt = plannedstmt; /* plan */ |
| 103 | qd->sourceText = sourceText; /* query text */ |
| 104 | qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ |
| 105 | /* RI check snapshot */ |
| 106 | qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot); |
| 107 | qd->dest = dest; /* output dest */ |
| 108 | qd->params = params; /* parameter values passed into query */ |
| 109 | qd->queryEnv = queryEnv; |
| 110 | qd->instrument_options = instrument_options; /* instrumentation wanted? */ |
| 111 | |
| 112 | /* null these fields until set by ExecutorStart */ |
| 113 | qd->tupDesc = NULL; |
| 114 | qd->estate = NULL; |
| 115 | qd->planstate = NULL; |
| 116 | qd->totaltime = NULL; |
| 117 | |
| 118 | qd->extended_query = false; /* default value */ |
| 119 | qd->portal_name = NULL; |
| 120 | qd->showstatctx = NULL; |
| 121 | |
| 122 | qd->ddesc = NULL; |
| 123 | |
| 124 | /* not yet executed */ |
| 125 | qd->already_executed = false; |
| 126 | |
| 127 | if (Gp_role != GP_ROLE_EXECUTE) |
| 128 | increment_command_count(); |
| 129 | |
| 130 | return qd; |
| 131 | } |
| 132 | |
| 133 | /* |
| 134 | * FreeQueryDesc |
no test coverage detected