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

Commitcff60f2

Browse files
committed
Avoid creating PlaceHolderVars immediately within PlaceHolderVars.
Such a construction is useless since the lower PlaceHolderVar is alreadynullable; no need to make it more so. Noted while pursuing bug #6154.This is just a minor planner efficiency improvement, since the final planwill come out the same anyway after PHVs are flattened. So not worth therisk of back-patching.
1 parentf4a9da0 commitcff60f2

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

‎src/backend/optimizer/prep/prepjointree.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,12 @@ pullup_replace_vars_callback(Var *var,
14111411
/* Simple Vars always escape being wrapped */
14121412
wrap= false;
14131413
}
1414+
elseif (newnode&&IsA(newnode,PlaceHolderVar)&&
1415+
((PlaceHolderVar*)newnode)->phlevelsup==0)
1416+
{
1417+
/* No need to wrap a PlaceHolderVar with another one, either */
1418+
wrap= false;
1419+
}
14141420
elseif (rcon->wrap_non_vars)
14151421
{
14161422
/* Wrap all non-Vars in a PlaceHolderVar */
@@ -1420,10 +1426,16 @@ pullup_replace_vars_callback(Var *var,
14201426
{
14211427
/*
14221428
* If it contains a Var of current level, and does not contain
1423-
* any non-strict constructs, then it's certainly nullable and
1424-
* we don't need to insert a PlaceHolderVar. (Note: in future
1425-
* maybe we should insert PlaceHolderVars anyway, when a tlist
1426-
* item is expensive to evaluate?
1429+
* any non-strict constructs, then it's certainly nullable so
1430+
* we don't need to insert a PlaceHolderVar.
1431+
*
1432+
* This analysis could be tighter: in particular, a non-strict
1433+
* construct hidden within a lower-level PlaceHolderVar is not
1434+
* reason to add another PHV. But for now it doesn't seem
1435+
* worth the code to be more exact.
1436+
*
1437+
* Note: in future maybe we should insert a PlaceHolderVar
1438+
* anyway, if the tlist item is expensive to evaluate?
14271439
*/
14281440
if (contain_vars_of_level((Node*)newnode,0)&&
14291441
!contain_nonstrict_functions((Node*)newnode))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp