Hi, I am resending this from my Gmail address. The original post from my datastone address was held because of its DKIM signature, and Álvaro kindly forwarded it to the list [1] (thank you!), but the archive page shows only his cover note, not the text or the patches. The text and the v1 patches below are unchanged.
[1] https://www.postgresql.org/message-id/awhmJzLrRcGRw5Zj%40alvherre.pgsql While building an extension that guards against the documented REPACK (CONCURRENTLY) caveat, I found three places where the documentation of commands that are not MVCC-safe is incomplete or inconsistent. The attached patches fix the docs only; no behaviour changes. 0001 doc: REPACK (CONCURRENTLY) affects snapshots taken before it commits The <warning> on the REPACK reference page says the table appears empty to transactions "using a snapshot taken before repacking started". The MVCC "Caveats" section says, correctly, before the repacking transaction committed. The difference matters because REPACK (CONCURRENTLY) can run for a long time: a transaction that takes its snapshot while it runs, and reads the table after the commit, also sees it as empty. The patch aligns the warning with mvcc.sgml and notes that max_repack_replication_slots = 0 disables the CONCURRENTLY option for a whole server. 0002 doc: pg_dump can dump a table as empty after a non-MVCC-safe command pg_dump takes its snapshot and then locks the tables. If a command that is not MVCC-safe commits on a table in between, the dump has no rows for that table, pg_dump exits with 0, and the restore succeeds. For TRUNCATE and rewriting ALTER TABLE the window is short. For REPACK (CONCURRENTLY), which takes its exclusive lock only for the final swap, any dump started while the repack runs is exposed. The pg_dump page does not mention this; the patch adds a paragraph that points to the MVCC caveats. 0003 doc: REFRESH MATERIALIZED VIEW without CONCURRENTLY is not MVCC-safe The refresh writes the new contents with TABLE_INSERT_FROZEN (matview.c, transientrel_startup), so a transaction whose snapshot predates the refresh, and which had not yet read the view, sees the new contents after the commit: data newer than its snapshot. The caveats section does not list this command, and its "appears empty" description does not fit it. The patch documents it in mvcc.sgml and on the command's reference page. The behaviour is long-standing, so the patch documents it as it is. Each commit message has a two-session reproducer; all three give the wrong result on 19.0 and on master at 9ebc9a458c3 (cassert build). 0001 and 0002 describe behaviour new in 19 and apply cleanly to REL_19_STABLE; I would suggest back-patching them to 19. 0003 applies to REL_19_STABLE too; the behaviour it documents is older than 19. The patches apply to master at 9ebc9a458c3 and REL_19_STABLE at 20d6f4a22e5, and the documentation builds without warnings on both (make -C doc/src/sgml check html). For context, the extension is pg_repack_safe https://github.com/datastone-inc/pg_repack_safe it turns the "appears empty" read into a serialization failure. Its doc/problem.md has longer reproducers, including the pg_dump one. I used an AI assistant (Claude) to help write the patches and reproducers; I have checked every statement against the 19 sources and run the reproducers myself. Regards, Dave Sharpe
v1-0001-doc-REPACK-CONCURRENTLY-affects-snapshots-taken-b.patch
Description: Binary data
v1-0003-doc-REFRESH-MATERIALIZED-VIEW-without-CONCURRENTL.patch
Description: Binary data
v1-0002-doc-pg_dump-can-dump-a-table-as-empty-after-a-non.patch
Description: Binary data
