---------------------------------------------------------------- * ExecReScanIndexScan(node) * * Recalculates the values of any scan keys whose value depends on * information known at runtime, then rescans the indexed relation. * * Updating the scan key was formerly done separately in * ExecUpdateIndexScanKeys. Integrating it into ReScan makes * rescans of indices and relations/gener
| 552 | * ---------------------------------------------------------------- |
| 553 | */ |
| 554 | void |
| 555 | ExecReScanIndexScan(IndexScanState *node) |
| 556 | { |
| 557 | /* |
| 558 | * If we are doing runtime key calculations (ie, any of the index key |
| 559 | * values weren't simple Consts), compute the new key values. But first, |
| 560 | * reset the context so we don't leak memory as each outer tuple is |
| 561 | * scanned. Note this assumes that we will recalculate *all* runtime keys |
| 562 | * on each call. |
| 563 | */ |
| 564 | if (node->iss_NumRuntimeKeys != 0) |
| 565 | { |
| 566 | ExprContext *econtext = node->iss_RuntimeContext; |
| 567 | |
| 568 | ResetExprContext(econtext); |
| 569 | ExecIndexEvalRuntimeKeys(econtext, |
| 570 | node->iss_RuntimeKeys, |
| 571 | node->iss_NumRuntimeKeys); |
| 572 | } |
| 573 | node->iss_RuntimeKeysReady = true; |
| 574 | |
| 575 | /* flush the reorder queue */ |
| 576 | if (node->iss_ReorderQueue) |
| 577 | { |
| 578 | HeapTuple tuple; |
| 579 | while (!pairingheap_is_empty(node->iss_ReorderQueue)) |
| 580 | { |
| 581 | tuple = reorderqueue_pop(node); |
| 582 | heap_freetuple(tuple); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | /* reset index scan */ |
| 587 | if (node->iss_ScanDesc) |
| 588 | index_rescan(node->iss_ScanDesc, |
| 589 | node->iss_ScanKeys, node->iss_NumScanKeys, |
| 590 | node->iss_OrderByKeys, node->iss_NumOrderByKeys); |
| 591 | node->iss_ReachedEnd = false; |
| 592 | |
| 593 | ExecScanReScan(&node->ss); |
| 594 | } |
| 595 | |
| 596 | |
| 597 | /* |
no test coverage detected