postgresql/src/backend
Tom Lane 07eb22a776 Ensure we have a snapshot while dropping ON COMMIT DROP temp tables.
Dropping a temp table could entail TOAST table access to clean out
toasted catalog entries, such as large pg_constraint.conbin strings
for complex CHECK constraints.  If we did that via ON COMMIT DROP,
we triggered the assertion in init_toast_snapshot(), because
there was no provision for setting up a snapshot for the drop
actions.  Fix that.

(I assume here that the adjacent truncation actions for ON COMMIT
DELETE ROWS don't have a similar problem: it doesn't seem like
nontransactional truncations would need to touch any toasted fields.
If that proves wrong, we could refactor a bit to have the same
snapshot acquisition cover that too.)

The test case added here does not fail before v15, because that
assertion was added in 277692220 which was not back-patched.
However, the race condition the assertion warns of surely
exists further back, so back-patch to all supported branches.

Per report from Richard Guo.

Discussion: https://postgr.es/m/CAMbWs4-x26=_QxxgdJyNbiCDzvtr2WV5ZDso_v-CukKEe6cBZw@mail.gmail.com
2023-10-16 14:06:11 -04:00
..
access Fix bug in GenericXLogFinish(). 2023-10-10 11:03:10 -07:00
bootstrap
catalog Fix checking of index expressions in CompareIndexInfo(). 2023-09-28 14:05:25 -04:00
commands Ensure we have a snapshot while dropping ON COMMIT DROP temp tables. 2023-10-16 14:06:11 -04:00
executor Fix runtime partition pruning for HASH partitioned tables 2023-10-13 01:14:46 +13:00
foreign
jit Fix leak of LLVM "fatal-on-oom" section counter. 2023-07-05 13:14:24 +03:00
lib
libpq Raise fixed token-length limit in hba.c. 2023-07-27 12:07:48 -04:00
main
nodes
optimizer Collect dependency information for parsed CallStmts. 2023-09-25 14:41:57 -04:00
parser Track nesting depth correctly when drilling down into RECORD Vars. 2023-09-15 17:01:26 -04:00
partitioning Fix incorrect step generation in HASH partition pruning 2023-10-12 19:53:23 +13:00
po Translation updates 2023-08-07 12:35:56 +02:00
port
postmaster Avoid memory size overflow when allocating backend activity buffer 2023-10-03 15:37:24 +09:00
regex Avoid character classification in regex escape parsing. 2023-04-21 08:21:04 -07:00
replication Fix uninitialized access to InitialRunningXacts during decoding after ERROR. 2023-09-12 09:44:37 +05:30
rewrite Fix typo in comment. 2023-06-16 10:19:51 +09:00
snowball
statistics
storage Ensure that creation of an empty relfile is fsync'd at checkpoint. 2023-07-04 18:08:26 +03:00
tcop Be more rigorous about local variables in PostgresMain(). 2023-07-10 12:14:34 -04:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Acquire ControlFileLock in relevant SQL functions. 2023-10-16 10:47:33 +13:00
.gitignore
common.mk
Makefile
nls.mk