Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7ea758b

Browse files
committed
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 Resultnodes inserted just above a nestloop inner indexscan. Should think aboutusing the general Param mechanism to pass down outer-relation variables, butfor the moment we need a back-patchable solution. Per report from Phil Frost.
1 parent4ebb0cf commit7ea758b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

‎src/backend/executor/nodeResult.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
4040
* IDENTIFICATION
41-
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.38 2007/02/15 03:07:13 tgl Exp $
41+
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.39 2007/02/16 03:49:04 tgl Exp $
4242
*
4343
*-------------------------------------------------------------------------
4444
*/
@@ -309,10 +309,12 @@ ExecReScanResult(ResultState *node, ExprContext *exprCtxt)
309309
node->rs_checkqual= (node->resconstantqual==NULL) ? false : true;
310310

311311
/*
312-
* if chgParam of subnode is not null then plan will be re-scanned by
313-
* first ExecProcNode.
312+
* If chgParam of subnode is not null then plan will be re-scanned by
313+
* first ExecProcNode. However, if caller is passing us an exprCtxt
314+
* then forcibly rescan the subnode now, so that we can pass the
315+
* exprCtxt down to the subnode (needed for gated indexscan).
314316
*/
315-
if (((PlanState*)node)->lefttree&&
316-
((PlanState*)node)->lefttree->chgParam==NULL)
317-
ExecReScan(((PlanState*)node)->lefttree,exprCtxt);
317+
if (node->ps.lefttree&&
318+
(node->ps.lefttree->chgParam==NULL||exprCtxt!=NULL))
319+
ExecReScan(node->ps.lefttree,exprCtxt);
318320
}

‎src/backend/optimizer/plan/setrefs.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.128 2007/01/22 01:35:20 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.129 2007/02/16 03:49:04 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -936,6 +936,14 @@ set_inner_join_references(Plan *inner_plan, indexed_tlist *outer_itlist)
936936
outer_itlist);
937937
}
938938
}
939+
elseif (IsA(inner_plan,Result))
940+
{
941+
/* Recurse through a gating Result node (similar to Append case) */
942+
Result*result= (Result*)inner_plan;
943+
944+
if (result->plan.lefttree)
945+
set_inner_join_references(result->plan.lefttree,outer_itlist);
946+
}
939947
elseif (IsA(inner_plan,TidScan))
940948
{
941949
TidScan*innerscan= (TidScan*)inner_plan;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp