]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid fetching from an already-terminated plan.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 Sep 2021 17:36:31 +0000 (13:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 9 Sep 2021 17:36:44 +0000 (13:36 -0400)
commitb7056c0a25e545f4c1efcc1e2a6118e4626e377b
tree17f7efbdb20d249a0b2ccf6d5329d878260e469e
parentb27d0cd3147e2a0215253f61944c392a30265db8
Avoid fetching from an already-terminated plan.

Some plan node types don't react well to being called again after
they've already returned NULL.  PortalRunSelect() has long dealt
with this by calling the executor with NoMovementScanDirection
if it sees that we've already run the portal to the end.  However,
commit ba2c6d6ce overlooked this point, so that persisting an
already-fully-fetched cursor would fail if it had such a plan.

Per report from Tomas Barton.  Back-patch to v11, as the faulty
commit was.  (I've omitted a test case because the type of plan
that causes a problem isn't all that stable.)

Discussion: https://postgr.es/m/CAPV2KRjd=ErgVGbvO2Ty20tKTEZZr6cYsYLxgN_W3eAo9pf5sw@mail.gmail.com
src/backend/commands/portalcmds.c