| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com> |
| Subject: | Re: pg_dump --exclude-table loses FOR ALL TABLES EXCEPT publications |
| Date: | 2026-11-06 08:08:46 |
| Message-ID: | CAN4CZFNE9qFe0E4BGpyu1yvrnd7f-jBN4rwX1=O8wxQPsVRtPA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> "When -t is specified, pg_dump makes no attempt to dump any other
> database objects that the selected table(s) might depend upon.
That note is actually my problem: because it documents the opposite
case: it says that when we exclude some tables, we do not dump any
other database object depending on it. That the quoted limitation is
for -e, -n, -t, while the issue I reported is about -N, -T and
--exclude-table-and-children.
And also note the inconsistency: with -e, -n and -t, we do what is
documented, resulting in a consistent restore that produces no errors
and no publications.
With the other options, it is the opposite: we dump publications that
depend on excluded database objects. Consequently, the restore ends
without the publication and prints errors.
So while I am also leaning towards simply documenting this, as I think
the current behavior is better than the alternative, we are
documenting an inconsistency. (And that's also the reason why I think
it is important to document this)
The comment for selectDumpablePublicationObject is also similarly incorrect:
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.
When we exclude some tables, we clearly do not dump everything, but we
still dump publications.
As I wrote earlier, I think that keeping the current behavior is
correct: there's a reasonable chance that the user restores the
missing excluded table before the main dump, in which case we want to
have these publications there for completeness, excluding them would
be the wrong choice.
> OTOH, if others think that will be
> helpful, I won't mind adding it.
So I think expanding the note about this, and adjusting the code
comment would be an improvement, see attached patch. But if everyone
else disagrees, I am also fine with leaving it as-is.
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Doc-Note-that-pg_dump-keeps-publication-entries-f.patch | application/octet-stream | 2.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-11-06 08:14:31 | Re: Report buffer access strategies in EXPLAIN |
| Previous Message | Ashutosh Bapat | 2026-11-06 07:45:29 | Re: Call CalculateShmemSize() only once |