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

Commit21fb95d

Browse files
committed
Use a fresh copy of query_list when making a second plan in GetCachedPlan.
The code path that tried a generic plan, didn't like it, and then made acustom plan was mistakenly passing the same copy of the query_list to theplanner both times. This doesn't work too well for nontrivial queries,since the planner tends to scribble on its input. Diagnosis and fix byYamamoto Takashi.
1 parent2a571bc commit21fb95d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/utils/cache/plancache.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ CheckCachedPlan(CachedPlanSource *plansource)
697697
/*
698698
* BuildCachedPlan: construct a new CachedPlan from a CachedPlanSource.
699699
*
700-
* qlist should be the result value from a previous RevalidateCachedQuery.
700+
* qlist should be the result value from a previous RevalidateCachedQuery,
701+
* or it can be set to NIL if we need to re-copy the plansource's query_list.
701702
*
702703
* To build a generic, parameter-value-independent plan, pass NULL for
703704
* boundParams. To build a custom plan, pass the actual parameter values via
@@ -980,6 +981,13 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
980981
* plan.
981982
*/
982983
customplan=choose_custom_plan(plansource,boundParams);
984+
985+
/*
986+
* If we choose to plan again, we need to re-copy the query_list,
987+
* since the planner probably scribbled on it. We can force
988+
* BuildCachedPlan to do that by passing NIL.
989+
*/
990+
qlist=NIL;
983991
}
984992
}
985993

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp