postgresql/src/backend/commands
Tom Lane f6e1ee3cfa 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
..
Makefile Split copy.c into four files. 2020-11-23 10:50:50 +02:00
aggregatecmds.c SQL-standard function body 2021-04-07 21:47:55 +02:00
alter.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
amcmds.c Fix some typos, grammar and style in docs and comments 2021-02-24 16:13:17 +09:00
analyze.c Fix briefly showing old progress stats for ANALYZE on inherited tables. 2023-09-30 17:07:37 +03:00
async.c Send NOTIFY signals during CommitTransaction. 2021-09-14 17:18:25 -04:00
cluster.c Make relation-enumerating operations be security-restricted operations. 2022-05-09 08:35:12 -07:00
collationcmds.c Disallow creating an ICU collation if the DB encoding won't support it. 2021-09-03 16:39:04 -04:00
comment.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
constraint.c Pass down "logically unchanged index" hint. 2021-01-13 08:11:00 -08:00
conversioncmds.c Add 'noError' argument to encoding conversion functions. 2021-04-01 11:45:22 +03:00
copy.c Ensure COPY TO on an RLS-enabled table copies no more than it should. 2023-03-10 13:52:28 -05:00
copyfrom.c In COPY FROM, fail cleanly when unsupported encoding conversion is needed. 2023-10-01 12:09:26 -04:00
copyfromparse.c Fix typo in comment. 2022-08-26 16:55:02 +09:00
copyto.c Ensure COPY TO on an RLS-enabled table copies no more than it should. 2023-03-10 13:52:28 -05:00
createas.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
dbcommands.c Handle DROP DATABASE getting interrupted 2023-07-13 13:03:33 -07:00
define.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
discard.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
dropcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
event_trigger.c Improve handling of dropped objects in pg_event_trigger_ddl_commands() 2021-06-14 14:57:22 +09:00
explain.c Add compute_query_id = regress 2022-02-22 10:23:49 +09:00
extension.c Reject substituting extension schemas or owners matching ["$'\]. 2023-08-07 06:06:00 -07:00
foreigncmds.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
functioncmds.c Fix breakage in AlterFunction(). 2022-04-19 23:03:59 -04:00
indexcmds.c Fix marking of indisvalid for partitioned indexes at creation 2023-06-30 13:54:56 +09:00
lockcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
matview.c In REFRESH MATERIALIZED VIEW, set user ID before running user code. 2022-05-09 08:35:12 -07:00
opclasscmds.c Fix DDL deparse of CREATE OPERATOR CLASS 2022-05-20 18:52:55 +02:00
operatorcmds.c Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership. 2021-08-17 14:29:22 -04:00
policy.c Remove unnecessary failure cases in RemoveRoleFromObjectPolicy(). 2021-06-25 13:59:38 -04:00
portalcmds.c Fix some anomalies with NO SCROLL cursors. 2021-09-10 13:18:32 -04:00
prepare.c Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
proclang.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
publicationcmds.c Invalidate all partitions for a partitioned table in publication. 2021-09-22 08:13:37 +05:30
schemacmds.c Replace last PushOverrideSearchPath() call with set_config_option(). 2023-05-08 06:14:11 -07:00
seclabel.c Check criticalSharedRelcachesBuilt in GetSharedSecurityLabel(). 2021-10-14 12:24:22 -07:00
sequence.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
statscmds.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
subscriptioncmds.c Fix the errhint message and docs for drop subscription failure. 2023-06-21 10:23:09 +05:30
tablecmds.c Ensure we have a snapshot while dropping ON COMMIT DROP temp tables. 2023-10-16 14:06:11 -04:00
tablespace.c Fix replay of create database records on standby 2022-07-28 08:26:05 +02:00
trigger.c Fix oversight in handling of modifiedCols since f24523672d 2023-07-02 22:23:04 +02:00
tsearchcmds.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
typecmds.c Fix use-after-free with multirange types in CREATE TYPE 2021-10-13 16:38:15 +09:00
user.c Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
vacuum.c Handle DROP DATABASE getting interrupted 2023-07-13 13:03:33 -07:00
variable.c Fix some inappropriately-disallowed uses of ALTER ROLE/DATABASE SET. 2021-04-13 15:10:18 -04:00
view.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00