bug in plancache.c - Mailing list pgsql-bugs

From yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
Subject bug in plancache.c
Date
Msg-id 20110926101548.8FA8A14A143@mail.netbsd.org
Whole thread Raw
Responses Re: bug in plancache.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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 */

pgsql-bugs by date:

Previous
From: "Dean Heller"
Date:
Subject: BUG #6224: Installation Error of dotconnect for postgre SQL Professional
Next
From: Dave Page
Date:
Subject: Re: BUG #6223: Installation with service account