postgresql/src
Tom Lane 57868d957e Avoid crash when rolling back within a prepared statement.
If a portal is used to run a prepared CALL or DO statement that
contains a ROLLBACK, PortalRunMulti fails because the portal's
statement list gets cleared by the rollback.  (Since the grammar
doesn't allow CALL/DO in PREPARE, the only easy way to get to this is
via extended query protocol, which treats all inputs as prepared
statements.)  It's difficult to avoid resetting the portal early
because of resource-management issues, so work around this by teaching
PortalRunMulti to be wary of portal->stmts having suddenly become NIL.

The crash has only been seen to occur in v13 and HEAD (as a
consequence of commit 1cff1b95a having added an extra touch of
portal->stmts).  But even before that, the code involved touching a
List that the portal no longer has any claim on.  In the test case at
hand, the List will still exist because of another refcount on the
cached plan; but I'm far from convinced that it's impossible for the
cached plan to have been dropped by the time control gets back to
PortalRunMulti.  Hence, backpatch to v11 where nested transactions
were added.

Thomas Munro and Tom Lane, per bug #16811 from James Inform

Discussion: https://postgr.es/m/16811-c1b599b2c6c2d622@postgresql.org
2021-02-03 19:38:29 -05:00
..
backend Avoid crash when rolling back within a prepared statement. 2021-02-03 19:38:29 -05:00
bin pg_dump: Fix dumping of inherited generated columns 2021-02-03 11:43:01 +01:00
common Second thoughts on TOAST decompression. 2020-11-02 11:25:18 -05:00
fe_utils Remove incorrect %s in string 2020-11-09 10:38:43 +01:00
include Revive "snapshot too old" with wal_level=minimal and SET TABLESPACE. 2021-01-30 00:13:58 -08:00
interfaces Make ecpg's rjulmdy() and rmdyjul() agree with their declarations. 2021-01-28 11:17:28 -05:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Remove extra increment of plpgsql's statement counter for FOR loops. 2021-02-02 14:35:20 -05:00
port Clear some style deviations. 2020-05-21 08:31:16 -07:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:31 -05:00
test Fix error with CREATE PUBLICATION, wal_level=minimal, and new tables. 2021-01-30 00:12:05 -08:00
timezone Update time zone data files to tzdata release 2021a. 2021-01-24 16:29:47 -05:00
tools backpatch "jit: Add support for LLVM 12." 2020-12-07 18:32:32 -08:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Update Unicode data to Unicode 13.0.0 and CLDR 37 2020-04-24 09:52:59 +02:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00