Skip to content

Commit 55a586b

Browse files
committed
Ignore publication tables when --no-publications is used
96e1cb4 has added support for --no-publications in pg_dump, pg_dumpall and pg_restore, but forgot the fact that publication tables also need to be ignored when this option is used. Author: Gilles Darold Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/3f48e812-b0fa-388e-2043-9a176bdee27e@dalibo.com Backpatch-through: 10, where publications have been added.
1 parent 90a1f97 commit 55a586b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,8 +2837,13 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt)
28372837
if (ropt->aclsSkip && _tocEntryIsACL(te))
28382838
return 0;
28392839

2840-
/* If it's a publication, maybe ignore it */
2841-
if (ropt->no_publications && strcmp(te->desc, "PUBLICATION") == 0)
2840+
/*
2841+
* If it's a publication or a table part of a publication, maybe ignore
2842+
* it.
2843+
*/
2844+
if (ropt->no_publications &&
2845+
(strcmp(te->desc, "PUBLICATION") == 0 ||
2846+
strcmp(te->desc, "PUBLICATION TABLE") == 0))
28422847
return 0;
28432848

28442849
/* If it's security labels, maybe ignore it */

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3601,14 +3601,15 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
36013601
PQExpBuffer query;
36023602
PGresult *res;
36033603
PublicationRelInfo *pubrinfo;
3604+
DumpOptions *dopt = fout->dopt;
36043605
int i_tableoid;
36053606
int i_oid;
36063607
int i_pubname;
36073608
int i,
36083609
j,
36093610
ntups;
36103611

3611-
if (fout->remoteVersion < 100000)
3612+
if (dopt->no_publications || fout->remoteVersion < 100000)
36123613
return;
36133614

36143615
query = createPQExpBuffer();

0 commit comments

Comments
 (0)