---------------------------------------------------------------- * ExecInitUnique * * This initializes the unique node state structures and * the node's subplan. * ---------------------------------------------------------------- */
| 113 | * ---------------------------------------------------------------- |
| 114 | */ |
| 115 | UniqueState * |
| 116 | ExecInitUnique(Unique *node, EState *estate, int eflags) |
| 117 | { |
| 118 | UniqueState *uniquestate; |
| 119 | |
| 120 | /* check for unsupported flags */ |
| 121 | Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK))); |
| 122 | |
| 123 | /* |
| 124 | * create state structure |
| 125 | */ |
| 126 | uniquestate = makeNode(UniqueState); |
| 127 | uniquestate->ps.plan = (Plan *) node; |
| 128 | uniquestate->ps.state = estate; |
| 129 | uniquestate->ps.ExecProcNode = ExecUnique; |
| 130 | |
| 131 | /* |
| 132 | * create expression context |
| 133 | */ |
| 134 | ExecAssignExprContext(estate, &uniquestate->ps); |
| 135 | |
| 136 | /* |
| 137 | * then initialize outer plan |
| 138 | */ |
| 139 | outerPlanState(uniquestate) = ExecInitNode(outerPlan(node), estate, eflags); |
| 140 | |
| 141 | /* |
| 142 | * Initialize result slot and type. Unique nodes do no projections, so |
| 143 | * initialize projection info for this node appropriately. |
| 144 | */ |
| 145 | ExecInitResultTupleSlotTL(&uniquestate->ps, &TTSOpsMinimalTuple); |
| 146 | uniquestate->ps.ps_ProjInfo = NULL; |
| 147 | |
| 148 | /* |
| 149 | * Precompute fmgr lookup data for inner loop |
| 150 | */ |
| 151 | uniquestate->eqfunction = |
| 152 | execTuplesMatchPrepare(ExecGetResultType(outerPlanState(uniquestate)), |
| 153 | node->numCols, |
| 154 | node->uniqColIdx, |
| 155 | node->uniqOperators, |
| 156 | node->uniqCollations, |
| 157 | &uniquestate->ps); |
| 158 | |
| 159 | return uniquestate; |
| 160 | } |
| 161 | |
| 162 | /* ---------------------------------------------------------------- |
| 163 | * ExecEndUnique |
no test coverage detected