diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-09-25 11:05:29 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-09-25 11:05:29 +0900 |
commit | 55a586ba9715b044d7b23a2f60dc003ddcf9239a (patch) | |
tree | 5476462d83850cad9da2c8f67945bfa1d7a8753b | |
parent | 90a1f97867feb6b6469c641f0e4a00842c52bafb (diff) | |
download | postgresql-55a586ba9715b044d7b23a2f60dc003ddcf9239a.tar.gz postgresql-55a586ba9715b044d7b23a2f60dc003ddcf9239a.zip |
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.
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 9 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 5cbe6658dbe..a2e2f96986a 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -2837,8 +2837,13 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt) if (ropt->aclsSkip && _tocEntryIsACL(te)) return 0; - /* If it's a publication, maybe ignore it */ - if (ropt->no_publications && strcmp(te->desc, "PUBLICATION") == 0) + /* + * If it's a publication or a table part of a publication, maybe ignore + * it. + */ + if (ropt->no_publications && + (strcmp(te->desc, "PUBLICATION") == 0 || + strcmp(te->desc, "PUBLICATION TABLE") == 0)) return 0; /* If it's security labels, maybe ignore it */ diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index db19f924d80..376b8c7db78 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -3601,6 +3601,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables) PQExpBuffer query; PGresult *res; PublicationRelInfo *pubrinfo; + DumpOptions *dopt = fout->dopt; int i_tableoid; int i_oid; int i_pubname; @@ -3608,7 +3609,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables) j, ntups; - if (fout->remoteVersion < 100000) + if (dopt->no_publications || fout->remoteVersion < 100000) return; query = createPQExpBuffer(); |