bug in plancache.c
bug in plancache.c
От:
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
Дата:
hi,
GetCachedPlan can pass the 'qlist' to the planner twice.
if i understand the code correctly, it's unsafe because the planner is
destructive wrt the input tree. for my application, it often causes
a crash in executor.
YAMAMOTO Takashi
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index cfeb824..78c2c31 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -949,6 +949,7 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams,
{
/* Build a new generic plan */
plan = BuildCachedPlan(plansource, qlist, NULL);
+ qlist = NIL;
/* Just make real sure plansource->gplan is clear */
ReleaseGenericPlan(plansource);
/* Link the new generic plan into the plansource */Re: bug in plancache.c
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) writes: > GetCachedPlan can pass the 'qlist' to the planner twice. > if i understand the code correctly, it's unsafe because the planner is > destructive wrt the input tree. for my application, it often causes > a crash in executor. Good catch, thanks! (But a fix like this really requires a comment IMO.) regards, tom lane