Skip site navigation (1) Skip section navigation (2)

bug in plancache.c

From: yamt(at)mwd(dot)biglobe(dot)ne(dot)jp (YAMAMOTO Takashi)
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: bug in plancache.c
Date: 2011-09-26 10:15:48
Message-ID: 20110926101548.8FA8A14A143@mail.netbsd.org (view raw or flat)
Thread:
Lists: 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 */

Responses

pgsql-bugs by date

Next:From: Peter EisentrautDate: 2011-09-26 10:52:23
Subject: Re: [v9.2] make_greater_string() does not return a string in some cases
Previous:From: YAMAMOTO TakashiDate: 2011-09-26 10:06:53
Subject: Re: BUG #6218: TRAP: FailedAssertion( "!(owner->nsnapshots == 0)", File: "resowner.c", Line: 365)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group