aboutsummaryrefslogtreecommitdiff
path: root/contrib/jsonb_plperl
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-10-01 11:10:12 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-10-01 11:10:12 -0400
commite6adaa1795d593edd616b9541fff0920637f9721 (patch)
treeabd9aff43210fdf80e5b695fc90d1e74191945ef /contrib/jsonb_plperl
parent8de4a31720c2c2ce55f73f4af4b3cdc6cdcca225 (diff)
downloadpostgresql-e6adaa1795d593edd616b9541fff0920637f9721.tar.gz
postgresql-e6adaa1795d593edd616b9541fff0920637f9721.zip
Fix Portal snapshot tracking to handle subtransactions properly.
Commit 84f5c2908 forgot to consider the possibility that EnsurePortalSnapshotExists could run inside a subtransaction with lifespan shorter than the Portal's. In that case, the new active snapshot would be popped at the end of the subtransaction, leaving a dangling pointer in the Portal, with mayhem ensuing. To fix, make sure the ActiveSnapshot stack entry is marked with the same subtransaction nesting level as the associated Portal. It's certainly safe to do so since we won't be here at all unless the stack is empty; hence we can't create an out-of-order stack. Let's also apply this logic in the case where PortalRunUtility sets portalSnapshot, just to be sure that path can't cause similar problems. It's slightly less clear that that path can't create an out-of-order stack, so add an assertion guarding it. Report and patch by Bertrand Drouvot (with kibitzing by me). Back-patch to v11, like the previous commit. Discussion: https://postgr.es/m/ff82b8c5-77f4-3fe7-6028-fcf3303e82dd@amazon.com
Diffstat (limited to 'contrib/jsonb_plperl')
0 files changed, 0 insertions, 0 deletions