---------------------------------------------------------------- * ExecSetOp * ---------------------------------------------------------------- */
| 187 | * ---------------------------------------------------------------- |
| 188 | */ |
| 189 | static TupleTableSlot * /* return: a tuple or NULL */ |
| 190 | ExecSetOp(PlanState *pstate) |
| 191 | { |
| 192 | SetOpState *node = castNode(SetOpState, pstate); |
| 193 | SetOp *plannode = (SetOp *) node->ps.plan; |
| 194 | TupleTableSlot *resultTupleSlot = node->ps.ps_ResultTupleSlot; |
| 195 | |
| 196 | CHECK_FOR_INTERRUPTS(); |
| 197 | |
| 198 | /* |
| 199 | * If the previously-returned tuple needs to be returned more than once, |
| 200 | * keep returning it. |
| 201 | */ |
| 202 | if (node->numOutput > 0) |
| 203 | { |
| 204 | node->numOutput--; |
| 205 | return resultTupleSlot; |
| 206 | } |
| 207 | |
| 208 | /* Otherwise, we're done if we are out of groups */ |
| 209 | if (node->setop_done) |
| 210 | return NULL; |
| 211 | |
| 212 | /* Fetch the next tuple group according to the correct strategy */ |
| 213 | if (plannode->strategy == SETOP_HASHED) |
| 214 | { |
| 215 | if (!node->table_filled) |
| 216 | setop_fill_hash_table(node); |
| 217 | return setop_retrieve_hash_table(node); |
| 218 | } |
| 219 | else |
| 220 | return setop_retrieve_direct(node); |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | * ExecSetOp for non-hashed case |
nothing calls this directly
no test coverage detected