Re: BUG #15990: PROCEDURE throws "SQL Error [XX000]: ERROR: no known snapshots" with PostGIS geometries
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, a.wicht@gmail.com,
pgsql-bugs@lists.postgresql.org,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2021-05-12T03:25:57Z
Lists: pgsql-bugs
Attachments
- fix-commit-inside-cursor-loop.patch (text/x-diff) patch
I wrote: > I think the bigger-picture question is, if we're trying to detoast > as the first step in a new transaction of a procedure, where's the > guarantee that the TOAST data still exists to be fetched? For sure > we aren't holding any locks that would stop VACUUM from reclaiming > recently-dead TOAST rows. Yeah. So here's a patch I actually believe in to some extent, based on Konstantin's idea. > I'm still wondering why plpgsql-toast.spec is failing to show the > problem, too. The answer to that is that it's not testing commit-inside-a-cursor-loop, and if it were, it'd still fail to show the problem because its test table contains just one row. Interestingly, if you try the test case added here without adding the code patch, you get a "missing chunk number ... for toast value ..." error, not "no known snapshots". I think that's because the test case has additional commands after the COMMIT, causing the transaction snapshot to get re-established. regards, tom lane
Commits
-
Remove plpgsql's special-case code paths for SET/RESET.
- 30168be8f75b 14.0 landed
-
Restore the portal-level snapshot after procedure COMMIT/ROLLBACK.
- 84f5c2908dad 14.0 landed
- ef9480509622 11.13 landed
- d18ee6f92d9a 13.4 landed
- 41c6a5bec25e 12.8 landed
-
Avoid detoasting failure after COMMIT inside a plpgsql FOR loop.
- f21fadafaf0f 14.0 landed
- c64183f234e8 13.4 landed
- 8d341d6cb6c9 12.8 landed
- 0c1b2cb17c25 11.13 landed