---------------------------------------------------------------- * TidRangeNext * * Retrieve a tuple from the TidRangeScan node's currentRelation * using the TIDs in the TidRangeScanState information. * * ---------------------------------------------------------------- */
| 213 | * ---------------------------------------------------------------- |
| 214 | */ |
| 215 | static TupleTableSlot * |
| 216 | TidRangeNext(TidRangeScanState *node) |
| 217 | { |
| 218 | TableScanDesc scandesc; |
| 219 | EState *estate; |
| 220 | ScanDirection direction; |
| 221 | TupleTableSlot *slot; |
| 222 | |
| 223 | /* |
| 224 | * extract necessary information from TID scan node |
| 225 | */ |
| 226 | scandesc = node->ss.ss_currentScanDesc; |
| 227 | estate = node->ss.ps.state; |
| 228 | slot = node->ss.ss_ScanTupleSlot; |
| 229 | direction = estate->es_direction; |
| 230 | |
| 231 | if (!node->trss_inScan) |
| 232 | { |
| 233 | /* First time through, compute TID range to scan */ |
| 234 | if (!TidRangeEval(node)) |
| 235 | return NULL; |
| 236 | |
| 237 | if (scandesc == NULL) |
| 238 | { |
| 239 | scandesc = table_beginscan_tidrange(node->ss.ss_currentRelation, |
| 240 | estate->es_snapshot, |
| 241 | &node->trss_mintid, |
| 242 | &node->trss_maxtid); |
| 243 | node->ss.ss_currentScanDesc = scandesc; |
| 244 | } |
| 245 | else |
| 246 | { |
| 247 | /* rescan with the updated TID range */ |
| 248 | table_rescan_tidrange(scandesc, &node->trss_mintid, |
| 249 | &node->trss_maxtid); |
| 250 | } |
| 251 | |
| 252 | node->trss_inScan = true; |
| 253 | } |
| 254 | |
| 255 | /* Fetch the next tuple. */ |
| 256 | if (!table_scan_getnextslot_tidrange(scandesc, direction, slot)) |
| 257 | { |
| 258 | node->trss_inScan = false; |
| 259 | ExecClearTuple(slot); |
| 260 | } |
| 261 | |
| 262 | return slot; |
| 263 | } |
| 264 | |
| 265 | /* |
| 266 | * TidRangeRecheck -- access method routine to recheck a tuple in EvalPlanQual |
nothing calls this directly
no test coverage detected