]> granicus.if.org Git - postgresql/commit
Fix failure to set ActiveSnapshot while rewinding a cursor.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 May 2014 18:25:28 +0000 (14:25 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 May 2014 18:25:28 +0000 (14:25 -0400)
commit2a527baa33372db723ca6b1b49b14da1e7a1b92e
tree29bb9964f003d829ba36d439241633278dc719f0
parentbd4c76a3c5d141462e149a130d0cbeca36e11e88
Fix failure to set ActiveSnapshot while rewinding a cursor.

ActiveSnapshot needs to be set when we call ExecutorRewind because some
plan node types may execute user-defined functions during their ReScan
calls (nodeLimit.c does so, at least).  The wisdom of that is somewhat
debatable, perhaps, but for now the simplest fix is to make sure the
required context is valid.  Failure to do this typically led to a
null-pointer-dereference core dump, though it's possible that in more
complex cases a function could be executed with the wrong snapshot
leading to very subtle misbehavior.

Per report from Leif Jensen.  It's been broken for a long time, so
back-patch to all active branches.
src/backend/tcop/pquery.c
src/test/regress/expected/portals.out
src/test/regress/sql/portals.sql