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

Commit789d3d4

Browse files
committed
Fix EXPLAIN to handle gating Result nodes within inner-indexscan subplans.
It is possible for a NestLoop plan node to pass an OUTER Var into an"inner indexscan" that is an Append construct (derived from an inheritancetree or UNION ALL subquery). The OUTER tuple is then passed down atruntime to the leaf indexscan node(s) where it will actually be used.EXPLAIN has to likewise pass the information about the nestloop's outersubplan down through the Append node, else it will fail to print theouter-reference Vars (with complaints like "bogus varno: 65001").However, there was a case missed in all this: we could also have gatingResult nodes that were inserted into the appendrel plan tree to deal withpseudoconstant qual conditions. So EXPLAIN has to pass down the outer plannode to a Result's subplan, too. Per example from Jon Nelson.The problem is gone in 9.1 because we replaced the nestloop outer-tuplekluge with a Param-based data transfer mechanism. Also, so far as I cantell, the case can't happen before 8.4 because of restrictions on whatsorts of appendrel members could be pulled up into the parent query.So this patch is only needed for 8.4 and 9.0.
1 parent4624228 commit789d3d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/backend/commands/explain.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,10 +1179,13 @@ ExplainNode(Plan *plan, PlanState *planstate,
11791179
/*
11801180
* Ordinarily we don't pass down our own outer_plan value to our child
11811181
* nodes, but in bitmap scan trees we must, since the bottom
1182-
* BitmapIndexScan nodes may have outer references.
1182+
* BitmapIndexScan nodes may have outer references. Also, we must do
1183+
* so at a Result node, because it might be a pseudoconstant-qual
1184+
* gating node inserted into an inner indexscan plan.
11831185
*/
11841186
ExplainNode(outerPlan(plan),outerPlanState(planstate),
1185-
IsA(plan,BitmapHeapScan) ?outer_plan :NULL,
1187+
(IsA(plan,BitmapHeapScan)||
1188+
IsA(plan,Result)) ?outer_plan :NULL,
11861189
"Outer",NULL,es);
11871190
}
11881191

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp