Use a fresh copy of query_list when making a second plan in GetCachedPlan.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 Sep 2011 16:44:17 +0000 (12:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 Sep 2011 16:44:17 +0000 (12:44 -0400)
commit21fb95da46bce8de3e149707c680d489b8a5ffb0
treed8592e7c92adbe249d0e4478f31128026fbf7363
parent2a571bc233821023afdf8729a3ae5071b2343f65
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 a
custom plan was mistakenly passing the same copy of the query_list to the
planner both times.  This doesn't work too well for nontrivial queries,
since the planner tends to scribble on its input.  Diagnosis and fix by
Yamamoto Takashi.
src/backend/utils/cache/plancache.c