PostgreSQL Source Code  git master
nodeIndexonlyscan.h File Reference
#include "access/parallel.h"
#include "nodes/execnodes.h"
Include dependency graph for nodeIndexonlyscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

IndexOnlyScanStateExecInitIndexOnlyScan (IndexOnlyScan *node, EState *estate, int eflags)
 
void ExecEndIndexOnlyScan (IndexOnlyScanState *node)
 
void ExecIndexOnlyMarkPos (IndexOnlyScanState *node)
 
void ExecIndexOnlyRestrPos (IndexOnlyScanState *node)
 
void ExecReScanIndexOnlyScan (IndexOnlyScanState *node)
 
void ExecIndexOnlyScanEstimate (IndexOnlyScanState *node, ParallelContext *pcxt)
 
void ExecIndexOnlyScanInitializeDSM (IndexOnlyScanState *node, ParallelContext *pcxt)
 
void ExecIndexOnlyScanReInitializeDSM (IndexOnlyScanState *node, ParallelContext *pcxt)
 
void ExecIndexOnlyScanInitializeWorker (IndexOnlyScanState *node, ParallelWorkerContext *pwcxt)
 

Function Documentation

◆ ExecEndIndexOnlyScan()

void ExecEndIndexOnlyScan ( IndexOnlyScanState node)

Definition at line 365 of file nodeIndexonlyscan.c.

366 {
367  Relation indexRelationDesc;
368  IndexScanDesc indexScanDesc;
369 
370  /*
371  * extract information from the node
372  */
373  indexRelationDesc = node->ioss_RelationDesc;
374  indexScanDesc = node->ioss_ScanDesc;
375 
376  /* Release VM buffer pin, if any. */
377  if (node->ioss_VMBuffer != InvalidBuffer)
378  {
381  }
382 
383  /*
384  * Free the exprcontext(s) ... now dead code, see ExecFreeExprContext
385  */
386 #ifdef NOT_USED
387  ExecFreeExprContext(&node->ss.ps);
388  if (node->ioss_RuntimeContext)
390 #endif
391 
392  /*
393  * clear out tuple table slots
394  */
395  if (node->ss.ps.ps_ResultTupleSlot)
398 
399  /*
400  * close the index relation (no-op if we didn't open it)
401  */
402  if (indexScanDesc)
403  index_endscan(indexScanDesc);
404  if (indexRelationDesc)
405  index_close(indexRelationDesc, NoLock);
406 }
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:4480
void FreeExprContext(ExprContext *econtext, bool isCommit)
Definition: execUtils.c:419
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:658
void index_close(Relation relation, LOCKMODE lockmode)
Definition: indexam.c:158
void index_endscan(IndexScanDesc scan)
Definition: indexam.c:327
#define NoLock
Definition: lockdefs.h:34
struct IndexScanDescData * ioss_ScanDesc
Definition: execnodes.h:1618
ExprContext * ioss_RuntimeContext
Definition: execnodes.h:1616
Relation ioss_RelationDesc
Definition: execnodes.h:1617
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:1075
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1477
PlanState ps
Definition: execnodes.h:1474
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:433

References ExecClearTuple(), ExecFreeExprContext(), FreeExprContext(), index_close(), index_endscan(), InvalidBuffer, IndexOnlyScanState::ioss_RelationDesc, IndexOnlyScanState::ioss_RuntimeContext, IndexOnlyScanState::ioss_ScanDesc, IndexOnlyScanState::ioss_VMBuffer, NoLock, ScanState::ps, PlanState::ps_ResultTupleSlot, ReleaseBuffer(), IndexOnlyScanState::ss, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

◆ ExecIndexOnlyMarkPos()

void ExecIndexOnlyMarkPos ( IndexOnlyScanState node)

Definition at line 416 of file nodeIndexonlyscan.c.

417 {
418  EState *estate = node->ss.ps.state;
419  EPQState *epqstate = estate->es_epq_active;
420 
421  if (epqstate != NULL)
422  {
423  /*
424  * We are inside an EvalPlanQual recheck. If a test tuple exists for
425  * this relation, then we shouldn't access the index at all. We would
426  * instead need to save, and later restore, the state of the
427  * relsubs_done flag, so that re-fetching the test tuple is possible.
428  * However, given the assumption that no caller sets a mark at the
429  * start of the scan, we can only get here with relsubs_done[i]
430  * already set, and so no state need be saved.
431  */
432  Index scanrelid = ((Scan *) node->ss.ps.plan)->scanrelid;
433 
434  Assert(scanrelid > 0);
435  if (epqstate->relsubs_slot[scanrelid - 1] != NULL ||
436  epqstate->relsubs_rowmark[scanrelid - 1] != NULL)
437  {
438  /* Verify the claim above */
439  if (!epqstate->relsubs_done[scanrelid - 1])
440  elog(ERROR, "unexpected ExecIndexOnlyMarkPos call in EPQ recheck");
441  return;
442  }
443  }
444 
446 }
unsigned int Index
Definition: c.h:598
#define ERROR
Definition: elog.h:39
void index_markpos(IndexScanDesc scan)
Definition: indexam.c:357
Assert(fmt[strlen(fmt) - 1] !='\n')
ExecAuxRowMark ** relsubs_rowmark
Definition: execnodes.h:1212
TupleTableSlot ** relsubs_slot
Definition: execnodes.h:1184
bool * relsubs_done
Definition: execnodes.h:1219
struct EPQState * es_epq_active
Definition: execnodes.h:691
Plan * plan
Definition: execnodes.h:1037
EState * state
Definition: execnodes.h:1039

References Assert(), elog(), ERROR, EState::es_epq_active, index_markpos(), IndexOnlyScanState::ioss_ScanDesc, PlanState::plan, ScanState::ps, EPQState::relsubs_done, EPQState::relsubs_rowmark, EPQState::relsubs_slot, IndexOnlyScanState::ss, and PlanState::state.

Referenced by ExecMarkPos().

◆ ExecIndexOnlyRestrPos()

void ExecIndexOnlyRestrPos ( IndexOnlyScanState node)

Definition at line 453 of file nodeIndexonlyscan.c.

454 {
455  EState *estate = node->ss.ps.state;
456  EPQState *epqstate = estate->es_epq_active;
457 
458  if (estate->es_epq_active != NULL)
459  {
460  /* See comments in ExecIndexMarkPos */
461  Index scanrelid = ((Scan *) node->ss.ps.plan)->scanrelid;
462 
463  Assert(scanrelid > 0);
464  if (epqstate->relsubs_slot[scanrelid - 1] != NULL ||
465  epqstate->relsubs_rowmark[scanrelid - 1] != NULL)
466  {
467  /* Verify the claim above */
468  if (!epqstate->relsubs_done[scanrelid - 1])
469  elog(ERROR, "unexpected ExecIndexOnlyRestrPos call in EPQ recheck");
470  return;
471  }
472  }
473 
475 }
void index_restrpos(IndexScanDesc scan)
Definition: indexam.c:381

References Assert(), elog(), ERROR, EState::es_epq_active, index_restrpos(), IndexOnlyScanState::ioss_ScanDesc, PlanState::plan, ScanState::ps, EPQState::relsubs_done, EPQState::relsubs_rowmark, EPQState::relsubs_slot, IndexOnlyScanState::ss, and PlanState::state.

Referenced by ExecRestrPos().

◆ ExecIndexOnlyScanEstimate()

void ExecIndexOnlyScanEstimate ( IndexOnlyScanState node,
ParallelContext pcxt 
)

Definition at line 642 of file nodeIndexonlyscan.c.

644 {
645  EState *estate = node->ss.ps.state;
646 
648  estate->es_snapshot);
650  shm_toc_estimate_keys(&pcxt->estimator, 1);
651 }
Size index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot)
Definition: indexam.c:406
#define shm_toc_estimate_chunk(e, sz)
Definition: shm_toc.h:51
#define shm_toc_estimate_keys(e, cnt)
Definition: shm_toc.h:53
Snapshot es_snapshot
Definition: execnodes.h:616
shm_toc_estimator estimator
Definition: parallel.h:42

References EState::es_snapshot, ParallelContext::estimator, index_parallelscan_estimate(), IndexOnlyScanState::ioss_PscanLen, IndexOnlyScanState::ioss_RelationDesc, ScanState::ps, shm_toc_estimate_chunk, shm_toc_estimate_keys, IndexOnlyScanState::ss, and PlanState::state.

Referenced by ExecParallelEstimate().

◆ ExecIndexOnlyScanInitializeDSM()

void ExecIndexOnlyScanInitializeDSM ( IndexOnlyScanState node,
ParallelContext pcxt 
)

Definition at line 660 of file nodeIndexonlyscan.c.

662 {
663  EState *estate = node->ss.ps.state;
664  ParallelIndexScanDesc piscan;
665 
666  piscan = shm_toc_allocate(pcxt->toc, node->ioss_PscanLen);
668  node->ioss_RelationDesc,
669  estate->es_snapshot,
670  piscan);
671  shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, piscan);
672  node->ioss_ScanDesc =
674  node->ioss_RelationDesc,
675  node->ioss_NumScanKeys,
676  node->ioss_NumOrderByKeys,
677  piscan);
678  node->ioss_ScanDesc->xs_want_itup = true;
680 
681  /*
682  * If no run-time keys to calculate or they are ready, go ahead and pass
683  * the scankeys to the index AM.
684  */
685  if (node->ioss_NumRuntimeKeys == 0 || node->ioss_RuntimeKeysReady)
687  node->ioss_ScanKeys, node->ioss_NumScanKeys,
689 }
IndexScanDesc index_beginscan_parallel(Relation heaprel, Relation indexrel, int nkeys, int norderbys, ParallelIndexScanDesc pscan)
Definition: indexam.c:492
void index_parallelscan_initialize(Relation heapRelation, Relation indexRelation, Snapshot snapshot, ParallelIndexScanDesc target)
Definition: indexam.c:441
void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
Definition: indexam.c:301
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
Definition: shm_toc.c:171
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
Definition: shm_toc.c:88
bool ioss_RuntimeKeysReady
Definition: execnodes.h:1615
struct ScanKeyData * ioss_ScanKeys
Definition: execnodes.h:1609
struct ScanKeyData * ioss_OrderByKeys
Definition: execnodes.h:1611
shm_toc * toc
Definition: parallel.h:45
int plan_node_id
Definition: plannodes.h:152
Relation ss_currentRelation
Definition: execnodes.h:1475

References EState::es_snapshot, index_beginscan_parallel(), index_parallelscan_initialize(), index_rescan(), InvalidBuffer, IndexOnlyScanState::ioss_NumOrderByKeys, IndexOnlyScanState::ioss_NumRuntimeKeys, IndexOnlyScanState::ioss_NumScanKeys, IndexOnlyScanState::ioss_OrderByKeys, IndexOnlyScanState::ioss_PscanLen, IndexOnlyScanState::ioss_RelationDesc, IndexOnlyScanState::ioss_RuntimeKeysReady, IndexOnlyScanState::ioss_ScanDesc, IndexOnlyScanState::ioss_ScanKeys, IndexOnlyScanState::ioss_VMBuffer, PlanState::plan, Plan::plan_node_id, ScanState::ps, shm_toc_allocate(), shm_toc_insert(), IndexOnlyScanState::ss, ScanState::ss_currentRelation, PlanState::state, ParallelContext::toc, and IndexScanDescData::xs_want_itup.

Referenced by ExecParallelInitializeDSM().

◆ ExecIndexOnlyScanInitializeWorker()

void ExecIndexOnlyScanInitializeWorker ( IndexOnlyScanState node,
ParallelWorkerContext pwcxt 
)

Definition at line 711 of file nodeIndexonlyscan.c.

713 {
714  ParallelIndexScanDesc piscan;
715 
716  piscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
717  node->ioss_ScanDesc =
719  node->ioss_RelationDesc,
720  node->ioss_NumScanKeys,
721  node->ioss_NumOrderByKeys,
722  piscan);
723  node->ioss_ScanDesc->xs_want_itup = true;
724 
725  /*
726  * If no run-time keys to calculate or they are ready, go ahead and pass
727  * the scankeys to the index AM.
728  */
729  if (node->ioss_NumRuntimeKeys == 0 || node->ioss_RuntimeKeysReady)
731  node->ioss_ScanKeys, node->ioss_NumScanKeys,
733 }
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
Definition: shm_toc.c:232

References index_beginscan_parallel(), index_rescan(), IndexOnlyScanState::ioss_NumOrderByKeys, IndexOnlyScanState::ioss_NumRuntimeKeys, IndexOnlyScanState::ioss_NumScanKeys, IndexOnlyScanState::ioss_OrderByKeys, IndexOnlyScanState::ioss_RelationDesc, IndexOnlyScanState::ioss_RuntimeKeysReady, IndexOnlyScanState::ioss_ScanDesc, IndexOnlyScanState::ioss_ScanKeys, PlanState::plan, Plan::plan_node_id, ScanState::ps, shm_toc_lookup(), IndexOnlyScanState::ss, ScanState::ss_currentRelation, ParallelWorkerContext::toc, and IndexScanDescData::xs_want_itup.

Referenced by ExecParallelInitializeWorker().

◆ ExecIndexOnlyScanReInitializeDSM()

void ExecIndexOnlyScanReInitializeDSM ( IndexOnlyScanState node,
ParallelContext pcxt 
)

Definition at line 698 of file nodeIndexonlyscan.c.

700 {
702 }
void index_parallelrescan(IndexScanDesc scan)
Definition: indexam.c:474

References index_parallelrescan(), and IndexOnlyScanState::ioss_ScanDesc.

Referenced by ExecParallelReInitializeDSM().

◆ ExecInitIndexOnlyScan()

IndexOnlyScanState* ExecInitIndexOnlyScan ( IndexOnlyScan node,
EState estate,
int  eflags 
)

Definition at line 489 of file nodeIndexonlyscan.c.

490 {
491  IndexOnlyScanState *indexstate;
492  Relation currentRelation;
493  LOCKMODE lockmode;
494  TupleDesc tupDesc;
495 
496  /*
497  * create state structure
498  */
499  indexstate = makeNode(IndexOnlyScanState);
500  indexstate->ss.ps.plan = (Plan *) node;
501  indexstate->ss.ps.state = estate;
502  indexstate->ss.ps.ExecProcNode = ExecIndexOnlyScan;
503 
504  /*
505  * Miscellaneous initialization
506  *
507  * create expression context for node
508  */
509  ExecAssignExprContext(estate, &indexstate->ss.ps);
510 
511  /*
512  * open the scan relation
513  */
514  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
515 
516  indexstate->ss.ss_currentRelation = currentRelation;
517  indexstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */
518 
519  /*
520  * Build the scan tuple type using the indextlist generated by the
521  * planner. We use this, rather than the index's physical tuple
522  * descriptor, because the latter contains storage column types not the
523  * types of the original datums. (It's the AM's responsibility to return
524  * suitable data anyway.)
525  */
526  tupDesc = ExecTypeFromTL(node->indextlist);
527  ExecInitScanTupleSlot(estate, &indexstate->ss, tupDesc,
528  &TTSOpsVirtual);
529 
530  /*
531  * We need another slot, in a format that's suitable for the table AM, for
532  * when we need to fetch a tuple from the table for rechecking visibility.
533  */
534  indexstate->ioss_TableSlot =
536  RelationGetDescr(currentRelation),
537  table_slot_callbacks(currentRelation));
538 
539  /*
540  * Initialize result type and projection info. The node's targetlist will
541  * contain Vars with varno = INDEX_VAR, referencing the scan tuple.
542  */
543  ExecInitResultTypeTL(&indexstate->ss.ps);
545 
546  /*
547  * initialize child expressions
548  *
549  * Note: we don't initialize all of the indexorderby expression, only the
550  * sub-parts corresponding to runtime keys (see below).
551  */
552  indexstate->ss.ps.qual =
553  ExecInitQual(node->scan.plan.qual, (PlanState *) indexstate);
554  indexstate->recheckqual =
555  ExecInitQual(node->recheckqual, (PlanState *) indexstate);
556 
557  /*
558  * If we are just doing EXPLAIN (ie, aren't going to run the plan), stop
559  * here. This allows an index-advisor plugin to EXPLAIN a plan containing
560  * references to nonexistent indexes.
561  */
562  if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
563  return indexstate;
564 
565  /* Open the index relation. */
566  lockmode = exec_rt_fetch(node->scan.scanrelid, estate)->rellockmode;
567  indexstate->ioss_RelationDesc = index_open(node->indexid, lockmode);
568 
569  /*
570  * Initialize index-specific scan state
571  */
572  indexstate->ioss_RuntimeKeysReady = false;
573  indexstate->ioss_RuntimeKeys = NULL;
574  indexstate->ioss_NumRuntimeKeys = 0;
575 
576  /*
577  * build the index scan keys from the index qualification
578  */
579  ExecIndexBuildScanKeys((PlanState *) indexstate,
580  indexstate->ioss_RelationDesc,
581  node->indexqual,
582  false,
583  &indexstate->ioss_ScanKeys,
584  &indexstate->ioss_NumScanKeys,
585  &indexstate->ioss_RuntimeKeys,
586  &indexstate->ioss_NumRuntimeKeys,
587  NULL, /* no ArrayKeys */
588  NULL);
589 
590  /*
591  * any ORDER BY exprs have to be turned into scankeys in the same way
592  */
593  ExecIndexBuildScanKeys((PlanState *) indexstate,
594  indexstate->ioss_RelationDesc,
595  node->indexorderby,
596  true,
597  &indexstate->ioss_OrderByKeys,
598  &indexstate->ioss_NumOrderByKeys,
599  &indexstate->ioss_RuntimeKeys,
600  &indexstate->ioss_NumRuntimeKeys,
601  NULL, /* no ArrayKeys */
602  NULL);
603 
604  /*
605  * If we have runtime keys, we need an ExprContext to evaluate them. The
606  * node's standard context won't do because we want to reset that context
607  * for every tuple. So, build another context just like the other one...
608  * -tgl 7/11/00
609  */
610  if (indexstate->ioss_NumRuntimeKeys != 0)
611  {
612  ExprContext *stdecontext = indexstate->ss.ps.ps_ExprContext;
613 
614  ExecAssignExprContext(estate, &indexstate->ss.ps);
615  indexstate->ioss_RuntimeContext = indexstate->ss.ps.ps_ExprContext;
616  indexstate->ss.ps.ps_ExprContext = stdecontext;
617  }
618  else
619  {
620  indexstate->ioss_RuntimeContext = NULL;
621  }
622 
623  /*
624  * all done.
625  */
626  return indexstate;
627 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:213
void ExecAssignScanProjectionInfoWithVarno(ScanState *node, int varno)
Definition: execScan.c:284
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:83
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1812
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1756
TupleDesc ExecTypeFromTL(List *targetList)
Definition: execTuples.c:1939
TupleTableSlot * ExecAllocTableSlot(List **tupleTable, TupleDesc desc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1172
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:488
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:728
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
Definition: executor.h:587
#define EXEC_FLAG_EXPLAIN_ONLY
Definition: executor.h:65
Relation index_open(Oid relationId, LOCKMODE lockmode)
Definition: indexam.c:132
int LOCKMODE
Definition: lockdefs.h:26
static TupleTableSlot * ExecIndexOnlyScan(PlanState *pstate)
void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, List *quals, bool isorderby, ScanKey *scanKeys, int *numScanKeys, IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, IndexArrayKeyInfo **arrayKeys, int *numArrayKeys)
#define makeNode(_type_)
Definition: nodes.h:176
#define INDEX_VAR
Definition: primnodes.h:216
#define RelationGetDescr(relation)
Definition: rel.h:530
List * es_tupleTable
Definition: execnodes.h:661
TupleTableSlot * ioss_TableSlot
Definition: execnodes.h:1619
ExprState * recheckqual
Definition: execnodes.h:1608
IndexRuntimeKeyInfo * ioss_RuntimeKeys
Definition: execnodes.h:1613
List * indexqual
Definition: plannodes.h:494
List * recheckqual
Definition: plannodes.h:495
List * indextlist
Definition: plannodes.h:497
List * indexorderby
Definition: plannodes.h:496
ExprState * qual
Definition: execnodes.h:1058
ExprContext * ps_ExprContext
Definition: execnodes.h:1076
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1043
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1476
Index scanrelid
Definition: plannodes.h:387
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References EState::es_tupleTable, EXEC_FLAG_EXPLAIN_ONLY, exec_rt_fetch(), ExecAllocTableSlot(), ExecAssignExprContext(), ExecAssignScanProjectionInfoWithVarno(), ExecIndexBuildScanKeys(), ExecIndexOnlyScan(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, ExecTypeFromTL(), index_open(), INDEX_VAR, IndexOnlyScan::indexid, IndexOnlyScan::indexorderby, IndexOnlyScan::indexqual, IndexOnlyScan::indextlist, IndexOnlyScanState::ioss_NumOrderByKeys, IndexOnlyScanState::ioss_NumRuntimeKeys, IndexOnlyScanState::ioss_NumScanKeys, IndexOnlyScanState::ioss_OrderByKeys, IndexOnlyScanState::ioss_RelationDesc, IndexOnlyScanState::ioss_RuntimeContext, IndexOnlyScanState::ioss_RuntimeKeys, IndexOnlyScanState::ioss_RuntimeKeysReady, IndexOnlyScanState::ioss_ScanKeys, IndexOnlyScanState::ioss_TableSlot, makeNode, PlanState::plan, ScanState::ps, PlanState::ps_ExprContext, PlanState::qual, IndexOnlyScanState::recheckqual, IndexOnlyScan::recheckqual, RelationGetDescr, RangeTblEntry::rellockmode, IndexOnlyScan::scan, Scan::scanrelid, IndexOnlyScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, PlanState::state, table_slot_callbacks(), and TTSOpsVirtual.

Referenced by ExecInitNode().

◆ ExecReScanIndexOnlyScan()

void ExecReScanIndexOnlyScan ( IndexOnlyScanState node)

Definition at line 330 of file nodeIndexonlyscan.c.

331 {
332  /*
333  * If we are doing runtime key calculations (ie, any of the index key
334  * values weren't simple Consts), compute the new key values. But first,
335  * reset the context so we don't leak memory as each outer tuple is
336  * scanned. Note this assumes that we will recalculate *all* runtime keys
337  * on each call.
338  */
339  if (node->ioss_NumRuntimeKeys != 0)
340  {
341  ExprContext *econtext = node->ioss_RuntimeContext;
342 
343  ResetExprContext(econtext);
344  ExecIndexEvalRuntimeKeys(econtext,
345  node->ioss_RuntimeKeys,
346  node->ioss_NumRuntimeKeys);
347  }
348  node->ioss_RuntimeKeysReady = true;
349 
350  /* reset index scan */
351  if (node->ioss_ScanDesc)
353  node->ioss_ScanKeys, node->ioss_NumScanKeys,
355 
356  ExecScanReScan(&node->ss);
357 }
void ExecScanReScan(ScanState *node)
Definition: execScan.c:298
#define ResetExprContext(econtext)
Definition: executor.h:543
void ExecIndexEvalRuntimeKeys(ExprContext *econtext, IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys)

References ExecIndexEvalRuntimeKeys(), ExecScanReScan(), index_rescan(), IndexOnlyScanState::ioss_NumOrderByKeys, IndexOnlyScanState::ioss_NumRuntimeKeys, IndexOnlyScanState::ioss_NumScanKeys, IndexOnlyScanState::ioss_OrderByKeys, IndexOnlyScanState::ioss_RuntimeContext, IndexOnlyScanState::ioss_RuntimeKeys, IndexOnlyScanState::ioss_RuntimeKeysReady, IndexOnlyScanState::ioss_ScanDesc, IndexOnlyScanState::ioss_ScanKeys, ResetExprContext, and IndexOnlyScanState::ss.

Referenced by ExecReScan().