From 663e309531ea7f60198aa102880ba9d5e408a77c Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Fri, 6 Nov 2026 07:42:11 +0000 Subject: [PATCH v1] Doc: Note that pg_dump keeps publication entries for excluded tables. pg_dump -T and -N do not affect publications, so excluded tables stay in them and the restore fails if those tables are missing. Document that, and fix the comment atop selectDumpablePublicationObject(). Author: Zsolt Parragi Backpatch-through: 19 --- doc/src/sgml/ref/pg_dump.sgml | 7 +++++++ src/bin/pg_dump/pg_dump.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 774be23b4f9..2b6ca743ffd 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1666,6 +1666,13 @@ CREATE DATABASE foo WITH TEMPLATE template0; not automatically restored. + + When tables are excluded with , + or , publications that + depend on them are still dumped in full, and restoring those + publications fails if the excluded tables do not exist. + + When a dump without schema is chosen and the option is used, pg_dump emits commands diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 69171d6b859..07508197eda 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -2275,7 +2275,9 @@ selectDumpableExtension(ExtensionInfo *extinfo, DumpOptions *dopt) * * A publication can have schemas and tables which have schemas, but those are * ignored in decision making, because publications are only dumped when we are - * dumping everything. + * dumping everything, but excluding tables or schemas does not change that. + * References to excluded objects are kept on purpose, so that they can be + * restored separately, before the rest of the dump. */ static void selectDumpablePublicationObject(DumpableObject *dobj, Archive *fout) -- 2.56.0