]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Do a conditional SPI_push/SPI_pop when replanning a query in
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Jul 2009 15:38:03 +0000 (15:38 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Jul 2009 15:38:03 +0000 (15:38 +0000)
commitb5f32d8dae9f6aa4208b61902f057b30bcdda8dc
tree58313f53854efba368546decbc2f4a93af970132
parent1201008103de91d30c78beb8cb4db1fd80cfc275
Do a conditional SPI_push/SPI_pop when replanning a query in
RevalidateCachedPlan.  This is to avoid a "SPI_ERROR_CONNECT" failure when
the planner calls a SPI-using function and we are already inside one.
The alternative fix is to expect callers of RevalidateCachedPlan to do this,
which seems likely to result in additional hard-to-detect bugs of omission.
Per reports from Frank van Vugt and Marek Lewczuk.

Back-patch to 8.3. It's much harder to trigger the bug in 8.3, due to a
smaller set of cases in which plans can be invalidated, but it could happen.
(I think perhaps only a SI reset event could make 8.3 fail here, but that's
certainly within the realm of possibility.)
src/backend/utils/cache/plancache.c