PostgreSQL Source Code  git master
pg_restore.c File Reference
#include "postgres_fe.h"
#include <ctype.h>
#include "dumputils.h"
#include "fe_utils/option_utils.h"
#include "filter.h"
#include "getopt_long.h"
#include "parallel.h"
#include "pg_backup_utils.h"
Include dependency graph for pg_restore.c:

Go to the source code of this file.

Functions

static void usage (const char *progname)
 
static void read_restore_filters (const char *filename, RestoreOptions *dopt)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file pg_restore.c.

60 {
62  int c;
63  int exit_code;
64  int numWorkers = 1;
65  Archive *AH;
66  char *inputFileSpec;
67  static int disable_triggers = 0;
68  static int enable_row_security = 0;
69  static int if_exists = 0;
70  static int no_data_for_failed_tables = 0;
71  static int outputNoTableAm = 0;
72  static int outputNoTablespaces = 0;
73  static int use_setsessauth = 0;
74  static int no_comments = 0;
75  static int no_publications = 0;
76  static int no_security_labels = 0;
77  static int no_subscriptions = 0;
78  static int strict_names = 0;
79 
80  struct option cmdopts[] = {
81  {"clean", 0, NULL, 'c'},
82  {"create", 0, NULL, 'C'},
83  {"data-only", 0, NULL, 'a'},
84  {"dbname", 1, NULL, 'd'},
85  {"exit-on-error", 0, NULL, 'e'},
86  {"exclude-schema", 1, NULL, 'N'},
87  {"file", 1, NULL, 'f'},
88  {"format", 1, NULL, 'F'},
89  {"function", 1, NULL, 'P'},
90  {"host", 1, NULL, 'h'},
91  {"index", 1, NULL, 'I'},
92  {"jobs", 1, NULL, 'j'},
93  {"list", 0, NULL, 'l'},
94  {"no-privileges", 0, NULL, 'x'},
95  {"no-acl", 0, NULL, 'x'},
96  {"no-owner", 0, NULL, 'O'},
97  {"no-reconnect", 0, NULL, 'R'},
98  {"port", 1, NULL, 'p'},
99  {"no-password", 0, NULL, 'w'},
100  {"password", 0, NULL, 'W'},
101  {"schema", 1, NULL, 'n'},
102  {"schema-only", 0, NULL, 's'},
103  {"superuser", 1, NULL, 'S'},
104  {"table", 1, NULL, 't'},
105  {"trigger", 1, NULL, 'T'},
106  {"use-list", 1, NULL, 'L'},
107  {"username", 1, NULL, 'U'},
108  {"verbose", 0, NULL, 'v'},
109  {"single-transaction", 0, NULL, '1'},
110 
111  /*
112  * the following options don't have an equivalent short option letter
113  */
114  {"disable-triggers", no_argument, &disable_triggers, 1},
115  {"enable-row-security", no_argument, &enable_row_security, 1},
116  {"if-exists", no_argument, &if_exists, 1},
117  {"no-data-for-failed-tables", no_argument, &no_data_for_failed_tables, 1},
118  {"no-table-access-method", no_argument, &outputNoTableAm, 1},
119  {"no-tablespaces", no_argument, &outputNoTablespaces, 1},
120  {"role", required_argument, NULL, 2},
121  {"section", required_argument, NULL, 3},
122  {"strict-names", no_argument, &strict_names, 1},
123  {"use-set-session-authorization", no_argument, &use_setsessauth, 1},
124  {"no-comments", no_argument, &no_comments, 1},
125  {"no-publications", no_argument, &no_publications, 1},
126  {"no-security-labels", no_argument, &no_security_labels, 1},
127  {"no-subscriptions", no_argument, &no_subscriptions, 1},
128  {"filter", required_argument, NULL, 4},
129 
130  {NULL, 0, NULL, 0}
131  };
132 
133  pg_logging_init(argv[0]);
135  set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
136 
138 
140 
141  progname = get_progname(argv[0]);
142 
143  if (argc > 1)
144  {
145  if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
146  {
147  usage(progname);
148  exit_nicely(0);
149  }
150  if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
151  {
152  puts("pg_restore (PostgreSQL) " PG_VERSION);
153  exit_nicely(0);
154  }
155  }
156 
157  while ((c = getopt_long(argc, argv, "acCd:ef:F:h:I:j:lL:n:N:Op:P:RsS:t:T:U:vwWx1",
158  cmdopts, NULL)) != -1)
159  {
160  switch (c)
161  {
162  case 'a': /* Dump data only */
163  opts->dataOnly = 1;
164  break;
165  case 'c': /* clean (i.e., drop) schema prior to create */
166  opts->dropSchema = 1;
167  break;
168  case 'C':
169  opts->createDB = 1;
170  break;
171  case 'd':
172  opts->cparams.dbname = pg_strdup(optarg);
173  break;
174  case 'e':
175  opts->exit_on_error = true;
176  break;
177  case 'f': /* output file name */
178  opts->filename = pg_strdup(optarg);
179  break;
180  case 'F':
181  if (strlen(optarg) != 0)
182  opts->formatName = pg_strdup(optarg);
183  break;
184  case 'h':
185  if (strlen(optarg) != 0)
186  opts->cparams.pghost = pg_strdup(optarg);
187  break;
188 
189  case 'j': /* number of restore jobs */
190  if (!option_parse_int(optarg, "-j/--jobs", 1,
191  PG_MAX_JOBS,
192  &numWorkers))
193  exit(1);
194  break;
195 
196  case 'l': /* Dump the TOC summary */
197  opts->tocSummary = 1;
198  break;
199 
200  case 'L': /* input TOC summary file name */
201  opts->tocFile = pg_strdup(optarg);
202  break;
203 
204  case 'n': /* Dump data for this schema only */
205  simple_string_list_append(&opts->schemaNames, optarg);
206  break;
207 
208  case 'N': /* Do not dump data for this schema */
209  simple_string_list_append(&opts->schemaExcludeNames, optarg);
210  break;
211 
212  case 'O':
213  opts->noOwner = 1;
214  break;
215 
216  case 'p':
217  if (strlen(optarg) != 0)
218  opts->cparams.pgport = pg_strdup(optarg);
219  break;
220  case 'R':
221  /* no-op, still accepted for backwards compatibility */
222  break;
223  case 'P': /* Function */
224  opts->selTypes = 1;
225  opts->selFunction = 1;
226  simple_string_list_append(&opts->functionNames, optarg);
227  break;
228  case 'I': /* Index */
229  opts->selTypes = 1;
230  opts->selIndex = 1;
231  simple_string_list_append(&opts->indexNames, optarg);
232  break;
233  case 'T': /* Trigger */
234  opts->selTypes = 1;
235  opts->selTrigger = 1;
236  simple_string_list_append(&opts->triggerNames, optarg);
237  break;
238  case 's': /* dump schema only */
239  opts->schemaOnly = 1;
240  break;
241  case 'S': /* Superuser username */
242  if (strlen(optarg) != 0)
243  opts->superuser = pg_strdup(optarg);
244  break;
245  case 't': /* Dump specified table(s) only */
246  opts->selTypes = 1;
247  opts->selTable = 1;
248  simple_string_list_append(&opts->tableNames, optarg);
249  break;
250 
251  case 'U':
252  opts->cparams.username = pg_strdup(optarg);
253  break;
254 
255  case 'v': /* verbose */
256  opts->verbose = 1;
258  break;
259 
260  case 'w':
261  opts->cparams.promptPassword = TRI_NO;
262  break;
263 
264  case 'W':
265  opts->cparams.promptPassword = TRI_YES;
266  break;
267 
268  case 'x': /* skip ACL dump */
269  opts->aclsSkip = 1;
270  break;
271 
272  case '1': /* Restore data in a single transaction */
273  opts->single_txn = true;
274  opts->exit_on_error = true;
275  break;
276 
277  case 0:
278 
279  /*
280  * This covers the long options without a short equivalent.
281  */
282  break;
283 
284  case 2: /* SET ROLE */
285  opts->use_role = pg_strdup(optarg);
286  break;
287 
288  case 3: /* section */
289  set_dump_section(optarg, &(opts->dumpSections));
290  break;
291 
292  case 4:
294  break;
295 
296  default:
297  /* getopt_long already emitted a complaint */
298  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
299  exit_nicely(1);
300  }
301  }
302 
303  /* Get file name from command line */
304  if (optind < argc)
305  inputFileSpec = argv[optind++];
306  else
307  inputFileSpec = NULL;
308 
309  /* Complain if any arguments remain */
310  if (optind < argc)
311  {
312  pg_log_error("too many command-line arguments (first is \"%s\")",
313  argv[optind]);
314  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
315  exit_nicely(1);
316  }
317 
318  /* Complain if neither -f nor -d was specified (except if dumping TOC) */
319  if (!opts->cparams.dbname && !opts->filename && !opts->tocSummary)
320  pg_fatal("one of -d/--dbname and -f/--file must be specified");
321 
322  /* Should get at most one of -d and -f, else user is confused */
323  if (opts->cparams.dbname)
324  {
325  if (opts->filename)
326  {
327  pg_log_error("options -d/--dbname and -f/--file cannot be used together");
328  pg_log_error_hint("Try \"%s --help\" for more information.", progname);
329  exit_nicely(1);
330  }
331  opts->useDB = 1;
332  }
333 
334  if (opts->dataOnly && opts->schemaOnly)
335  pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together");
336 
337  if (opts->dataOnly && opts->dropSchema)
338  pg_fatal("options -c/--clean and -a/--data-only cannot be used together");
339 
340  /*
341  * -C is not compatible with -1, because we can't create a database inside
342  * a transaction block.
343  */
344  if (opts->createDB && opts->single_txn)
345  pg_fatal("options -C/--create and -1/--single-transaction cannot be used together");
346 
347  /* Can't do single-txn mode with multiple connections */
348  if (opts->single_txn && numWorkers > 1)
349  pg_fatal("cannot specify both --single-transaction and multiple jobs");
350 
351  opts->disable_triggers = disable_triggers;
352  opts->enable_row_security = enable_row_security;
353  opts->noDataForFailedTables = no_data_for_failed_tables;
354  opts->noTableAm = outputNoTableAm;
355  opts->noTablespace = outputNoTablespaces;
356  opts->use_setsessauth = use_setsessauth;
357  opts->no_comments = no_comments;
358  opts->no_publications = no_publications;
359  opts->no_security_labels = no_security_labels;
360  opts->no_subscriptions = no_subscriptions;
361 
362  if (if_exists && !opts->dropSchema)
363  pg_fatal("option --if-exists requires option -c/--clean");
364  opts->if_exists = if_exists;
366 
367  if (opts->formatName)
368  {
369  switch (opts->formatName[0])
370  {
371  case 'c':
372  case 'C':
373  opts->format = archCustom;
374  break;
375 
376  case 'd':
377  case 'D':
378  opts->format = archDirectory;
379  break;
380 
381  case 't':
382  case 'T':
383  opts->format = archTar;
384  break;
385 
386  default:
387  pg_fatal("unrecognized archive format \"%s\"; please specify \"c\", \"d\", or \"t\"",
388  opts->formatName);
389  }
390  }
391 
392  AH = OpenArchive(inputFileSpec, opts->format);
393 
394  SetArchiveOptions(AH, NULL, opts);
395 
396  /*
397  * We don't have a connection yet but that doesn't matter. The connection
398  * is initialized to NULL and if we terminate through exit_nicely() while
399  * it's still NULL, the cleanup function will just be a no-op.
400  */
402 
403  /* Let the archiver know how noisy to be */
404  AH->verbose = opts->verbose;
405 
406  /*
407  * Whether to keep submitting sql commands as "pg_restore ... | psql ... "
408  */
409  AH->exit_on_error = opts->exit_on_error;
410 
411  if (opts->tocFile)
412  SortTocFromFile(AH);
413 
414  AH->numWorkers = numWorkers;
415 
416  if (opts->tocSummary)
417  PrintTOCSummary(AH);
418  else
419  {
421  RestoreArchive(AH);
422  }
423 
424  /* done, print a summary of ignored errors */
425  if (AH->n_errors)
426  pg_log_warning("errors ignored on restore: %d", AH->n_errors);
427 
428  /* AH may be freed in CloseArchive? */
429  exit_code = AH->n_errors ? 1 : 0;
430 
431  CloseArchive(AH);
432 
433  return exit_code;
434 }
void on_exit_close_archive(Archive *AHX)
Definition: parallel.c:328
void init_parallel_dump_utils(void)
Definition: parallel.c:236
#define PG_MAX_JOBS
Definition: parallel.h:48
#define PG_TEXTDOMAIN(domain)
Definition: c.h:1201
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:448
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition: getopt_long.c:60
#define no_argument
Definition: getopt_long.h:24
#define required_argument
Definition: getopt_long.h:25
exit(1)
void pg_logging_increase_verbosity(void)
Definition: logging.c:182
void pg_logging_init(const char *argv0)
Definition: logging.c:83
void pg_logging_set_level(enum pg_log_level new_level)
Definition: logging.c:173
#define pg_log_error(...)
Definition: logging.h:106
#define pg_log_error_hint(...)
Definition: logging.h:112
@ PG_LOG_WARNING
Definition: logging.h:38
const char * progname
Definition: main.c:44
bool option_parse_int(const char *optarg, const char *optname, int min_range, int max_range, int *result)
Definition: option_utils.c:50
static AmcheckOptions opts
Definition: pg_amcheck.c:111
void ProcessArchiveRestoreOptions(Archive *AHX)
RestoreOptions * NewRestoreOptions(void)
void CloseArchive(Archive *AHX)
void SortTocFromFile(Archive *AHX)
void PrintTOCSummary(Archive *AHX)
void SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt)
void RestoreArchive(Archive *AHX)
@ archTar
Definition: pg_backup.h:43
@ archCustom
Definition: pg_backup.h:42
@ archDirectory
Definition: pg_backup.h:45
Archive * OpenArchive(const char *FileSpec, const ArchiveFormat fmt)
void set_dump_section(const char *arg, int *dumpSections)
#define pg_fatal(...)
static int strict_names
Definition: pg_dump.c:108
static int if_exists
Definition: pg_dumpall.c:100
static int disable_triggers
Definition: pg_dumpall.c:99
#define exit_nicely(code)
Definition: pg_dumpall.c:126
static int no_comments
Definition: pg_dumpall.c:105
static int no_publications
Definition: pg_dumpall.c:106
static int no_security_labels
Definition: pg_dumpall.c:107
static int use_setsessauth
Definition: pg_dumpall.c:104
static int no_subscriptions
Definition: pg_dumpall.c:108
PGDLLIMPORT int optind
Definition: getopt.c:50
PGDLLIMPORT char * optarg
Definition: getopt.c:52
static void usage(const char *progname)
Definition: pg_restore.c:437
static void read_restore_filters(const char *filename, RestoreOptions *dopt)
Definition: pg_restore.c:515
#define pg_log_warning(...)
Definition: pgfnames.c:24
const char * get_progname(const char *argv0)
Definition: path.c:574
char * c
void simple_string_list_append(SimpleStringList *list, const char *val)
Definition: simple_list.c:63
bool strict_names
Definition: pg_amcheck.c:60
bool exit_on_error
Definition: pg_backup.h:235
int n_errors
Definition: pg_backup.h:236
int numWorkers
Definition: pg_backup.h:223
int verbose
Definition: pg_backup.h:215
@ TRI_YES
Definition: vacuumlo.c:38
@ TRI_NO
Definition: vacuumlo.c:37

References archCustom, archDirectory, archTar, CloseArchive(), disable_triggers, exit(), exit_nicely, Archive::exit_on_error, get_progname(), getopt_long(), if_exists, init_parallel_dump_utils(), Archive::n_errors, NewRestoreOptions(), no_argument, no_comments, no_publications, no_security_labels, no_subscriptions, Archive::numWorkers, on_exit_close_archive(), OpenArchive(), optarg, optind, option_parse_int(), opts, pg_fatal, pg_log_error, pg_log_error_hint, pg_log_warning, PG_LOG_WARNING, pg_logging_increase_verbosity(), pg_logging_init(), pg_logging_set_level(), PG_MAX_JOBS, pg_strdup(), PG_TEXTDOMAIN, PrintTOCSummary(), ProcessArchiveRestoreOptions(), progname, read_restore_filters(), required_argument, RestoreArchive(), set_dump_section(), set_pglocale_pgservice(), SetArchiveOptions(), simple_string_list_append(), SortTocFromFile(), AmcheckOptions::strict_names, strict_names, TRI_NO, TRI_YES, usage(), use_setsessauth, AmcheckOptions::verbose, and Archive::verbose.

◆ read_restore_filters()

static void read_restore_filters ( const char *  filename,
RestoreOptions dopt 
)
static

Definition at line 515 of file pg_restore.c.

516 {
517  FilterStateData fstate;
518  char *objname;
519  FilterCommandType comtype;
520  FilterObjectType objtype;
521 
522  filter_init(&fstate, filename, exit_nicely);
523 
524  while (filter_read_item(&fstate, &objname, &comtype, &objtype))
525  {
526  if (comtype == FILTER_COMMAND_TYPE_INCLUDE)
527  {
528  switch (objtype)
529  {
531  break;
538  pg_log_filter_error(&fstate, _("%s filter for \"%s\" is not allowed"),
539  "include",
540  filter_object_type_name(objtype));
541  exit_nicely(1);
542 
544  opts->selTypes = 1;
545  opts->selFunction = 1;
546  simple_string_list_append(&opts->functionNames, objname);
547  break;
549  opts->selTypes = 1;
550  opts->selIndex = 1;
551  simple_string_list_append(&opts->indexNames, objname);
552  break;
554  simple_string_list_append(&opts->schemaNames, objname);
555  break;
557  opts->selTypes = 1;
558  opts->selTable = 1;
559  simple_string_list_append(&opts->tableNames, objname);
560  break;
562  opts->selTypes = 1;
563  opts->selTrigger = 1;
564  simple_string_list_append(&opts->triggerNames, objname);
565  break;
566  }
567  }
568  else if (comtype == FILTER_COMMAND_TYPE_EXCLUDE)
569  {
570  switch (objtype)
571  {
573  break;
584  pg_log_filter_error(&fstate, _("%s filter for \"%s\" is not allowed"),
585  "exclude",
586  filter_object_type_name(objtype));
587  exit_nicely(1);
588 
590  simple_string_list_append(&opts->schemaExcludeNames, objname);
591  break;
592  }
593  }
594  else
595  {
596  Assert(comtype == FILTER_COMMAND_TYPE_NONE);
597  Assert(objtype == FILTER_OBJECT_TYPE_NONE);
598  }
599 
600  if (objname)
601  free(objname);
602  }
603 
604  filter_free(&fstate);
605 }
#define _(x)
Definition: elog.c:90
void filter_init(FilterStateData *fstate, const char *filename, exit_function f_exit)
Definition: filter.c:37
void filter_free(FilterStateData *fstate)
Definition: filter.c:61
bool filter_read_item(FilterStateData *fstate, char **objname, FilterCommandType *comtype, FilterObjectType *objtype)
Definition: filter.c:388
void pg_log_filter_error(FilterStateData *fstate, const char *fmt,...)
Definition: filter.c:155
const char * filter_object_type_name(FilterObjectType fot)
Definition: filter.c:83
FilterObjectType
Definition: filter.h:48
@ FILTER_OBJECT_TYPE_TABLE_DATA_AND_CHILDREN
Definition: filter.h:51
@ FILTER_OBJECT_TYPE_SCHEMA
Definition: filter.h:57
@ FILTER_OBJECT_TYPE_INDEX
Definition: filter.h:56
@ FILTER_OBJECT_TYPE_TRIGGER
Definition: filter.h:60
@ FILTER_OBJECT_TYPE_FOREIGN_DATA
Definition: filter.h:54
@ FILTER_OBJECT_TYPE_DATABASE
Definition: filter.h:52
@ FILTER_OBJECT_TYPE_FUNCTION
Definition: filter.h:55
@ FILTER_OBJECT_TYPE_TABLE_DATA
Definition: filter.h:50
@ FILTER_OBJECT_TYPE_NONE
Definition: filter.h:49
@ FILTER_OBJECT_TYPE_TABLE_AND_CHILDREN
Definition: filter.h:59
@ FILTER_OBJECT_TYPE_EXTENSION
Definition: filter.h:53
@ FILTER_OBJECT_TYPE_TABLE
Definition: filter.h:58
FilterCommandType
Definition: filter.h:38
@ FILTER_COMMAND_TYPE_NONE
Definition: filter.h:39
@ FILTER_COMMAND_TYPE_EXCLUDE
Definition: filter.h:41
@ FILTER_COMMAND_TYPE_INCLUDE
Definition: filter.h:40
#define free(a)
Definition: header.h:65
Assert(fmt[strlen(fmt) - 1] !='\n')
static char * filename
Definition: pg_dumpall.c:121

References _, Assert(), exit_nicely, filename, FILTER_COMMAND_TYPE_EXCLUDE, FILTER_COMMAND_TYPE_INCLUDE, FILTER_COMMAND_TYPE_NONE, filter_free(), filter_init(), FILTER_OBJECT_TYPE_DATABASE, FILTER_OBJECT_TYPE_EXTENSION, FILTER_OBJECT_TYPE_FOREIGN_DATA, FILTER_OBJECT_TYPE_FUNCTION, FILTER_OBJECT_TYPE_INDEX, filter_object_type_name(), FILTER_OBJECT_TYPE_NONE, FILTER_OBJECT_TYPE_SCHEMA, FILTER_OBJECT_TYPE_TABLE, FILTER_OBJECT_TYPE_TABLE_AND_CHILDREN, FILTER_OBJECT_TYPE_TABLE_DATA, FILTER_OBJECT_TYPE_TABLE_DATA_AND_CHILDREN, FILTER_OBJECT_TYPE_TRIGGER, filter_read_item(), free, opts, pg_log_filter_error(), and simple_string_list_append().

Referenced by main().

◆ usage()

static void usage ( const char *  progname)
static

Definition at line 437 of file pg_restore.c.

438 {
439  printf(_("%s restores a PostgreSQL database from an archive created by pg_dump.\n\n"), progname);
440  printf(_("Usage:\n"));
441  printf(_(" %s [OPTION]... [FILE]\n"), progname);
442 
443  printf(_("\nGeneral options:\n"));
444  printf(_(" -d, --dbname=NAME connect to database name\n"));
445  printf(_(" -f, --file=FILENAME output file name (- for stdout)\n"));
446  printf(_(" -F, --format=c|d|t backup file format (should be automatic)\n"));
447  printf(_(" -l, --list print summarized TOC of the archive\n"));
448  printf(_(" -v, --verbose verbose mode\n"));
449  printf(_(" -V, --version output version information, then exit\n"));
450  printf(_(" -?, --help show this help, then exit\n"));
451 
452  printf(_("\nOptions controlling the restore:\n"));
453  printf(_(" -a, --data-only restore only the data, no schema\n"));
454  printf(_(" -c, --clean clean (drop) database objects before recreating\n"));
455  printf(_(" -C, --create create the target database\n"));
456  printf(_(" -e, --exit-on-error exit on error, default is to continue\n"));
457  printf(_(" -I, --index=NAME restore named index\n"));
458  printf(_(" -j, --jobs=NUM use this many parallel jobs to restore\n"));
459  printf(_(" -L, --use-list=FILENAME use table of contents from this file for\n"
460  " selecting/ordering output\n"));
461  printf(_(" -n, --schema=NAME restore only objects in this schema\n"));
462  printf(_(" -N, --exclude-schema=NAME do not restore objects in this schema\n"));
463  printf(_(" -O, --no-owner skip restoration of object ownership\n"));
464  printf(_(" -P, --function=NAME(args) restore named function\n"));
465  printf(_(" -s, --schema-only restore only the schema, no data\n"));
466  printf(_(" -S, --superuser=NAME superuser user name to use for disabling triggers\n"));
467  printf(_(" -t, --table=NAME restore named relation (table, view, etc.)\n"));
468  printf(_(" -T, --trigger=NAME restore named trigger\n"));
469  printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
470  printf(_(" -1, --single-transaction restore as a single transaction\n"));
471  printf(_(" --disable-triggers disable triggers during data-only restore\n"));
472  printf(_(" --enable-row-security enable row security\n"));
473  printf(_(" --filter=FILENAME restore or skip objects based on expressions\n"
474  " in FILENAME\n"));
475  printf(_(" --if-exists use IF EXISTS when dropping objects\n"));
476  printf(_(" --no-comments do not restore comments\n"));
477  printf(_(" --no-data-for-failed-tables do not restore data of tables that could not be\n"
478  " created\n"));
479  printf(_(" --no-publications do not restore publications\n"));
480  printf(_(" --no-security-labels do not restore security labels\n"));
481  printf(_(" --no-subscriptions do not restore subscriptions\n"));
482  printf(_(" --no-table-access-method do not restore table access methods\n"));
483  printf(_(" --no-tablespaces do not restore tablespace assignments\n"));
484  printf(_(" --section=SECTION restore named section (pre-data, data, or post-data)\n"));
485  printf(_(" --strict-names require table and/or schema include patterns to\n"
486  " match at least one entity each\n"));
487  printf(_(" --use-set-session-authorization\n"
488  " use SET SESSION AUTHORIZATION commands instead of\n"
489  " ALTER OWNER commands to set ownership\n"));
490 
491  printf(_("\nConnection options:\n"));
492  printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
493  printf(_(" -p, --port=PORT database server port number\n"));
494  printf(_(" -U, --username=NAME connect as specified database user\n"));
495  printf(_(" -w, --no-password never prompt for password\n"));
496  printf(_(" -W, --password force password prompt (should happen automatically)\n"));
497  printf(_(" --role=ROLENAME do SET ROLE before restore\n"));
498 
499  printf(_("\n"
500  "The options -I, -n, -N, -P, -t, -T, and --section can be combined and specified\n"
501  "multiple times to select multiple objects.\n"));
502  printf(_("\nIf no input file name is supplied, then standard input is used.\n\n"));
503  printf(_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
504  printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
505 }
#define printf(...)
Definition: port.h:244

References _, printf, and progname.

Referenced by main().