diff options
Diffstat (limited to 'src/backend/executor/execScan.c')
-rw-r--r-- | src/backend/executor/execScan.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c index d4ed2358564..42acc102c63 100644 --- a/src/backend/executor/execScan.c +++ b/src/backend/executor/execScan.c @@ -246,10 +246,17 @@ void ExecAssignScanProjectionInfo(ScanState *node) { Scan *scan = (Scan *) node->ps.plan; + Index varno; + + /* Vars in an index-only scan's tlist should be INDEX_VAR */ + if (IsA(scan, IndexOnlyScan)) + varno = INDEX_VAR; + else + varno = scan->scanrelid; if (tlist_matches_tupdesc(&node->ps, scan->plan.targetlist, - scan->scanrelid, + varno, node->ss_ScanTupleSlot->tts_tupleDescriptor)) node->ps.ps_ProjInfo = NULL; else |