Fix pg_plan_queries() to restore the previous setting of ActiveSnapshot
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Mar 2008 23:58:35 +0000 (23:58 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 12 Mar 2008 23:58:35 +0000 (23:58 +0000)
commitc4f647c0de1a1409d530f0e04fc668dc6df2e93b
treed825693ece37ac5f9540bbc667938f4382e0461b
parentde1983c9b12619d437ed544546cb5c7e444f35f9
Fix pg_plan_queries() to restore the previous setting of ActiveSnapshot
(probably NULL) before exiting.  Up to now it's just left the variable as it
set it, which means that after we're done processing the current client
message, ActiveSnapshot is probably pointing at garbage (because this function
is typically run in MessageContext which will get reset).  There doesn't seem
to have been any code path in which that mattered before 8.3, but now the
plancache module might try to use the stale value if the next client message
is a Bind for a prepared statement that is in need of replanning.  Per report
from Alex Hunsaker.
src/backend/tcop/postgres.c