mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Fix another problem in 8.2 changes that allowed "one-time" qual conditions to
be checked at plan levels below the top; namely, we have to allow for Result nodes inserted just above a nestloop inner indexscan. Should think about using the general Param mechanism to pass down outer-relation variables, but for the moment we need a back-patchable solution. Per report from Phil Frost.
This commit is contained in:
parent
84222cf0dd
commit
36e24e8d17
@ -38,7 +38,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.34.2.3 2007/02/15 03:07:21 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.34.2.4 2007/02/16 03:49:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -309,10 +309,12 @@ ExecReScanResult(ResultState *node, ExprContext *exprCtxt)
|
||||
node->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
* If chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode. However, if caller is passing us an exprCtxt
|
||||
* then forcibly rescan the subnode now, so that we can pass the
|
||||
* exprCtxt down to the subnode (needed for gated indexscan).
|
||||
*/
|
||||
if (((PlanState *) node)->lefttree &&
|
||||
((PlanState *) node)->lefttree->chgParam == NULL)
|
||||
ExecReScan(((PlanState *) node)->lefttree, exprCtxt);
|
||||
if (node->ps.lefttree &&
|
||||
(node->ps.lefttree->chgParam == NULL || exprCtxt != NULL))
|
||||
ExecReScan(node->ps.lefttree, exprCtxt);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.126 2006/10/04 00:29:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.126.2.1 2007/02/16 03:49:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -937,6 +937,14 @@ set_inner_join_references(Plan *inner_plan, indexed_tlist *outer_itlist)
|
||||
outer_itlist);
|
||||
}
|
||||
}
|
||||
else if (IsA(inner_plan, Result))
|
||||
{
|
||||
/* Recurse through a gating Result node (similar to Append case) */
|
||||
Result *result = (Result *) inner_plan;
|
||||
|
||||
if (result->plan.lefttree)
|
||||
set_inner_join_references(result->plan.lefttree, outer_itlist);
|
||||
}
|
||||
else if (IsA(inner_plan, TidScan))
|
||||
{
|
||||
TidScan *innerscan = (TidScan *) inner_plan;
|
||||
|
Loading…
Reference in New Issue
Block a user