postgresql/src/include
Andres Freund ce5d489166 Fix bug due to confusion about what IsMVCCSnapshot means
In 0b96e734c5 I (Andres) relied on page_collect_tuples() being called only
with an MVCC snapshot, and added assertions to that end, but did not realize
that IsMVCCSnapshot() allows both proper MVCC snapshots and historical
snapshots, which behave quite similarly to MVCC snapshots.

Unfortunately that can lead to incorrect visibility results during logical
decoding, as a historical snapshot is interpreted as a plain MVCC
snapshot. The only reason this wasn't noticed earlier is that it's hard to
reach as most of the time there are no sequential scans during logical
decoding.

To fix the bug and avoid issues like this in the future, split
IsMVCCSnapshot() into IsMVCCSnapshot() and IsMVCCLikeSnapshot(), where now
only the latter includes historic snapshots.

One effect of this is that during logical decoding no page-at-a-time snapshots
are used, as otherwise runtime branches to handle historic snapshots would be
needed in some performance critical paths. Given how uncommon sequential scans
are during logical decoding, that seems acceptable.

Author: Antonin Houska <ah@cybertec.at>
Reported-by: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/61812.1770637345@localhost
2026-03-13 13:53:19 -04:00
..
access Add callback for I/O error messages in SLRUs 2026-03-13 16:21:06 +02:00
archive Update copyright for 2026 2026-01-01 13:24:10 -05:00
backup Update copyright for 2026 2026-01-01 13:24:10 -05:00
bootstrap Simplify creation of built-in functions with non-default ACLs. 2026-03-05 17:43:09 -05:00
catalog Add stats_reset column to pg_stat_database_conflicts. 2026-03-13 22:17:14 +09:00
commands Optimize COPY FROM (FORMAT {text,csv}) using SIMD. 2026-03-13 11:07:32 -05:00
common Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
datatype Update copyright for 2026 2026-01-01 13:24:10 -05:00
executor Enable fast default for domains with non-volatile constraints 2026-03-12 18:05:01 -04:00
fe_utils pg_dumpall: Fix handling of conflicting options. 2026-03-06 14:00:04 -06:00
foreign CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
jit Fix typos and inconsistencies in code and comments 2026-01-05 09:19:15 +09:00
lib Make use of pg_popcount() in more places. 2026-02-23 09:26:00 -06:00
libpq Don't include proc.h in shm_mq.h 2026-02-27 10:53:47 +01:00
mb Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
nodes Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
optimizer Convert NOT IN sublinks to anti-joins when safe 2026-03-12 09:45:18 +09:00
parser Introduce the REPACK command 2026-03-10 19:56:39 +01:00
partitioning Update copyright for 2026 2026-01-01 13:24:10 -05:00
pch Update copyright for 2026 2026-01-01 13:24:10 -05:00
port Fix some -Wcast-qual warnings 2026-02-27 21:57:33 +01:00
portability instrumentation: Drop INSTR_TIME_SET_CURRENT_LAZY macro 2026-02-26 10:39:29 -05:00
postmaster Fix some -Wcast-qual warnings 2026-02-27 21:57:33 +01:00
regex Update copyright for 2026 2026-01-01 13:24:10 -05:00
replication Avoid including utils/timestamp.h in conflict.h. 2026-02-23 10:19:05 +05:30
rewrite Update copyright for 2026 2026-01-01 13:24:10 -05:00
snowball Update to latest Snowball sources. 2026-01-05 15:22:37 -05:00
statistics Add support for "mcv" in pg_restore_extended_stats() 2026-01-29 12:14:08 +09:00
storage bufmgr: Remove the, now obsolete, BM_JUST_DIRTIED 2026-03-11 14:58:29 -04:00
tcop Introduce the REPACK command 2026-03-10 19:56:39 +01:00
tsearch Replace pg_mblen() with bounds-checked versions. 2026-02-09 12:44:04 +13:00
utils Fix bug due to confusion about what IsMVCCSnapshot means 2026-03-13 13:53:19 -04:00
.gitignore Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
c.h Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
fmgr.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
funcapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
getopt_long.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
meson.build Ensure that all three build methods install the same set of files. 2026-02-16 15:20:15 -05:00
miscadmin.h Add password expiration warnings. 2026-02-11 10:36:15 -06:00
pg_config.h.in Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
pg_config_manual.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_getopt.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_trace.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgstat.h Don't include wait_event.h in pgstat.h 2026-03-06 16:24:58 +01:00
pgtar.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgtime.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
port.h strnlen() is now required 2026-01-08 08:51:20 +01:00
postgres.h Remove Int8GetDatum function 2026-03-11 10:46:08 +01:00
postgres_ext.h Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
postgres_fe.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
varatt.h Improve type handling of varlena structures 2026-02-11 07:33:24 +09:00
windowapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00