postgresql/src/include/access
Tom Lane a0c632c1de Force immediate commit after CREATE DATABASE etc in extended protocol.
We have a few commands that "can't run in a transaction block",
meaning that if they complete their processing but then we fail
to COMMIT, we'll be left with inconsistent on-disk state.
However, the existing defenses for this are only watertight for
simple query protocol.  In extended protocol, we didn't commit
until receiving a Sync message.  Since the client is allowed to
issue another command instead of Sync, we're in trouble if that
command fails or is an explicit ROLLBACK.  In any case, sitting
in an inconsistent state while waiting for a client message
that might not come seems pretty risky.

This case wasn't reachable via libpq before we introduced pipeline
mode, but it's always been an intended aspect of extended query
protocol, and likely there are other clients that could reach it
before.

To fix, set a flag in PreventInTransactionBlock that tells
exec_execute_message to force an immediate commit.  This seems
to be the approach that does least damage to existing working
cases while still preventing the undesirable outcomes.

While here, add some documentation to protocol.sgml that explicitly
says how to use pipelining.  That's latent in the existing docs if
you know what to look for, but it's better to spell it out; and it
provides a place to document this new behavior.

Per bug #17434 from Yugo Nagata.  It's been wrong for ages,
so back-patch to all supported branches.

Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org
2022-07-26 13:07:03 -04:00
..
amapi.h Revert changes in HOT handling of BRIN indexes 2022-06-16 15:02:49 +02:00
amvalidate.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
attmap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
attnum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_internal.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_page.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_pageops.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_revmap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_tuple.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
brin_xlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
bufmask.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
clog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
commit_ts.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
detoast.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
genam.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
generic_xlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gin.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
gin_private.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ginblock.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
ginxlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gist_private.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gistscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
gistxlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
hash.h Add macros in hash and btree AMs to get the special area of their pages 2022-04-01 13:24:50 +09:00
hash_xlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
heapam.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
heapam_xlog.h Set relfrozenxid to oldest extant XID seen by VACUUM. 2022-04-03 09:57:21 -07:00
heaptoast.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
hio.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
htup.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
htup_details.h Change one AssertMacro to Assert 2022-04-06 09:10:24 +02:00
itup.h Overload index_form_tuple to allow the memory context to be supplied 2022-07-07 08:14:32 +12:00
multixact.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
nbtree.h Add macros in hash and btree AMs to get the special area of their pages 2022-04-01 13:24:50 +09:00
nbtxlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
parallel.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
printsimple.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
printtup.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
relation.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
reloptions.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
relscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rewriteheap.h Add missing 'extern' to function prototypes. 2022-05-12 12:39:33 -07:00
rmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
rmgrlist.h Revert "Logical decoding of sequences" 2022-04-07 20:06:36 +02:00
sdir.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
session.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
skey.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
slru.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgist.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgist_private.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
spgxlog.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
stratnum.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
subtrans.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
syncscan.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
sysattr.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
table.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tableam.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
timeline.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
toast_compression.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
toast_helper.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
toast_internals.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
transam.h Fix visibility check when XID is committed in CLOG but not in procarray. 2022-06-27 08:21:08 +03:00
tsmapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupconvert.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupdesc.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupdesc_details.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
tupmacs.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
twophase.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
twophase_rmgr.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
valid.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
visibilitymap.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
visibilitymapdefs.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xact.h Force immediate commit after CREATE DATABASE etc in extended protocol. 2022-07-26 13:07:03 -04:00
xlog.h Remove unused-and-misspelled function extern declaration. 2022-05-21 13:26:08 -04:00
xlog_internal.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
xlogarchive.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xlogdefs.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xloginsert.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
xlogprefetcher.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
xlogreader.h Make XLogRecGetBlockTag() throw error if there's no such block. 2022-04-11 17:43:53 -04:00
xlogrecord.h Add support for zstd with compression of full-page writes in WAL 2022-03-11 12:18:53 +09:00
xlogrecovery.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
xlogstats.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
xlogutils.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00