Skip to content

Commit 611afd9

Browse files
committed
Repair crash in EvalPlanQual of query involving nestloop with inner
index scan. Problem was that link to outer tuple wasn't being stored everyplace it needed to be.
1 parent 0f214ed commit 611afd9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/backend/executor/nodeIndexscan.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.64 2001/10/28 06:25:43 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.65 2001/11/12 17:18:06 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -339,10 +339,17 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
339339
{
340340
/*
341341
* If we are being passed an outer tuple, save it for runtime key
342-
* calc
342+
* calc. We also need to link it into the "regular" per-tuple
343+
* econtext, so it can be used during indexqualorig evaluations.
343344
*/
344345
if (exprCtxt != NULL)
346+
{
347+
ExprContext *stdecontext;
348+
345349
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
350+
stdecontext = node->scan.scanstate->cstate.cs_ExprContext;
351+
stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
352+
}
346353

347354
/*
348355
* Reset the runtime-key context so we don't leak memory as each

0 commit comments

Comments
 (0)