Skip to content

Commit cc3e9de

Browse files
committed
The shortcut exit that I recently added to ExecInitIndexScan() for
EXPLAIN-only operation was a little too short; it skipped initializing the node's result tuple type, which may be needed depending on what's above the indexscan node. Call ExecAssignResultTypeFromTL before exiting. (For good luck I moved up the ExecAssignScanProjectionInfo call as well, so that everything except indexscan-specific initialization will still be done.) Per example from Grant Finnemore.
1 parent 10f719a commit cc3e9de

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/executor/nodeIndexscan.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.122 2007/05/25 17:54:25 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.123 2007/05/31 20:45:26 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -522,6 +522,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
522522
*/
523523
ExecAssignScanType(&indexstate->ss, RelationGetDescr(currentRelation));
524524

525+
/*
526+
* Initialize result tuple type and projection info.
527+
*/
528+
ExecAssignResultTypeFromTL(&indexstate->ss.ps);
529+
ExecAssignScanProjectionInfo(&indexstate->ss);
530+
525531
/*
526532
* If we are just doing EXPLAIN (ie, aren't going to run the plan),
527533
* stop here. This allows an index-advisor plugin to EXPLAIN a plan
@@ -589,12 +595,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
589595
indexstate->iss_NumScanKeys,
590596
indexstate->iss_ScanKeys);
591597

592-
/*
593-
* Initialize result tuple type and projection info.
594-
*/
595-
ExecAssignResultTypeFromTL(&indexstate->ss.ps);
596-
ExecAssignScanProjectionInfo(&indexstate->ss);
597-
598598
/*
599599
* all done.
600600
*/

0 commit comments

Comments
 (0)