aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_restore.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-01-25 15:27:24 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-01-25 15:27:24 -0500
commit1368e92e16a098338e39c8e540bdf9f6cf35ebf4 (patch)
tree4800270dfb7b24da04054281189dac4b6f728f99 /src/bin/pg_dump/pg_restore.c
parentbb415675d8ab6e776321a96f9c0e77c12fda96ea (diff)
downloadpostgresql-1368e92e16a098338e39c8e540bdf9f6cf35ebf4.tar.gz
postgresql-1368e92e16a098338e39c8e540bdf9f6cf35ebf4.zip
Support --no-comments in pg_dump, pg_dumpall, pg_restore.
We have switches already to suppress other subsidiary object properties, such as ACLs, security labels, ownership, and tablespaces, so just on the grounds of symmetry we should allow suppressing comments as well. Also, commit 0d4e6ed30 added a positive reason to have this feature, i.e. to allow obtaining the old behavior of selective pg_restore should anyone desire that. Recent commits have removed the cases where pg_dump emitted comments on built-in objects that the restoring user might not have privileges to comment on, so the original primary motivation for this feature is gone, but it still seems at least somewhat useful in its own right. Robins Tharakan, reviewed by Fabrízio Mello Discussion: https://postgr.es/m/CAEP4nAx22Z4ch74oJGzr5RyyjcyUSbpiFLyeYXX8pehfou92ug@mail.gmail.com
Diffstat (limited to 'src/bin/pg_dump/pg_restore.c')
-rw-r--r--src/bin/pg_dump/pg_restore.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 860a211a3cc..edc14f176fa 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -71,6 +71,7 @@ main(int argc, char **argv)
static int no_data_for_failed_tables = 0;
static int outputNoTablespaces = 0;
static int use_setsessauth = 0;
+ static int no_comments = 0;
static int no_publications = 0;
static int no_security_labels = 0;
static int no_subscriptions = 0;
@@ -119,6 +120,7 @@ main(int argc, char **argv)
{"section", required_argument, NULL, 3},
{"strict-names", no_argument, &strict_names, 1},
{"use-set-session-authorization", no_argument, &use_setsessauth, 1},
+ {"no-comments", no_argument, &no_comments, 1},
{"no-publications", no_argument, &no_publications, 1},
{"no-security-labels", no_argument, &no_security_labels, 1},
{"no-subscriptions", no_argument, &no_subscriptions, 1},
@@ -358,6 +360,7 @@ main(int argc, char **argv)
opts->noDataForFailedTables = no_data_for_failed_tables;
opts->noTablespace = outputNoTablespaces;
opts->use_setsessauth = use_setsessauth;
+ opts->no_comments = no_comments;
opts->no_publications = no_publications;
opts->no_security_labels = no_security_labels;
opts->no_subscriptions = no_subscriptions;
@@ -482,6 +485,7 @@ usage(const char *progname)
printf(_(" --if-exists use IF EXISTS when dropping objects\n"));
printf(_(" --no-data-for-failed-tables do not restore data of tables that could not be\n"
" created\n"));
+ printf(_(" --no-comments do not dump comments\n"));
printf(_(" --no-publications do not restore publications\n"));
printf(_(" --no-security-labels do not restore security labels\n"));
printf(_(" --no-subscriptions do not restore subscriptions\n"));