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 */