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

Commit79edb2b

Browse files
committed
Fix recursion into previously planned sub-query in examine_simple_variable.
This code was looking at the sub-Query tree as seen in the parent query'sRangeTblEntry; but that's the pristine parser output, and what we need tolook at is the tree as it stands at the completion of planning. Otherwisewe might pick up a Var that references a subquery that got flattened andhence has no RelOptInfo in the subroot. Per report from Peter Geoghegan.
1 parent054219c commit79edb2b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4382,6 +4382,17 @@ examine_simple_variable(PlannerInfo *root, Var *var,
43824382
/* Subquery should have been planned already */
43834383
Assert(rel->subroot&&IsA(rel->subroot,PlannerInfo));
43844384

4385+
/*
4386+
* Switch our attention to the subquery as mangled by the planner.
4387+
* It was okay to look at the pre-planning version for the tests
4388+
* above, but now we need a Var that will refer to the subroot's
4389+
* live RelOptInfos. For instance, if any subquery pullup happened
4390+
* during planning, Vars in the targetlist might have gotten replaced,
4391+
* and we need to see the replacement expressions.
4392+
*/
4393+
subquery=rel->subroot->parse;
4394+
Assert(IsA(subquery,Query));
4395+
43854396
/* Get the subquery output expression referenced by the upper Var */
43864397
ste=get_tle_by_resno(subquery->targetList,var->varattno);
43874398
if (ste==NULL||ste->resjunk)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp