pgsql: Fix failure to set ActiveSnapshot while rewinding a cursor.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix failure to set ActiveSnapshot while rewinding a cursor.
Date: 2014-05-07 18:25:53
Message-ID: E1Wi6XR-0008DO-Fo@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/04e5025be8bbe572e12b19c4ba9e2a8360b8ffe5

Modified Files
--------------
src/backend/tcop/pquery.c | 14 ++++++++++++--
src/test/regress/expected/portals.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/portals.sql | 11 +++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-05-07 18:57:03 pgsql: Detach shared memory from bgworkers without shmem access.
Previous Message Robert Haas 2014-05-07 17:29:24 pgsql: Never crash-and-restart for bgworkers without shared memory acce