Definition at line 56 of file pg_restore.c.
References _, _restoreOptions::aclsSkip, archCustom, archDirectory, archTar, CloseArchive(), _restoreOptions::cparams, _restoreOptions::createDB, _restoreOptions::dataOnly, _connParams::dbname, disable_triggers, _restoreOptions::disable_triggers, _restoreOptions::dropSchema, _restoreOptions::dumpSections, _restoreOptions::enable_row_security, exit_nicely, _restoreOptions::exit_on_error, Archive::exit_on_error, _restoreOptions::filename, _restoreOptions::format, _restoreOptions::formatName, fprintf, _restoreOptions::functionNames, get_progname(), getopt_long(), if_exists, _restoreOptions::if_exists, _restoreOptions::indexNames, init_parallel_dump_utils(), Archive::n_errors, NewRestoreOptions(), no_argument, no_comments, _restoreOptions::no_comments, no_publications, _restoreOptions::no_publications, no_security_labels, _restoreOptions::no_security_labels, no_subscriptions, _restoreOptions::no_subscriptions, _restoreOptions::noDataForFailedTables, _restoreOptions::noOwner, _restoreOptions::noTablespace, Archive::numWorkers, on_exit_close_archive(), OpenArchive(), optarg, optind, opts, pg_log_error, pg_log_warning, PG_LOG_WARNING, pg_logging_increase_verbosity(), pg_logging_init(), pg_logging_set_level(), pg_strdup(), PG_TEXTDOMAIN, _connParams::pghost, _connParams::pgport, PrintTOCSummary(), ProcessArchiveRestoreOptions(), progname, _connParams::promptPassword, required_argument, RestoreArchive(), _restoreOptions::schemaExcludeNames, _restoreOptions::schemaNames, _restoreOptions::schemaOnly, _restoreOptions::selFunction, _restoreOptions::selIndex, _restoreOptions::selTable, _restoreOptions::selTrigger, _restoreOptions::selTypes, set_dump_section(), set_pglocale_pgservice(), SetArchiveOptions(), simple_string_list_append(), _restoreOptions::single_txn, SortTocFromFile(), _restoreOptions::strict_names, strict_names, _restoreOptions::superuser, _restoreOptions::tableNames, _restoreOptions::tocFile, _restoreOptions::tocSummary, TRI_NO, TRI_YES, _restoreOptions::triggerNames, usage(), _restoreOptions::use_role, use_setsessauth, _restoreOptions::use_setsessauth, _restoreOptions::useDB, _connParams::username, _restoreOptions::verbose, and Archive::verbose.
65 static int enable_row_security = 0;
67 static int no_data_for_failed_tables = 0;
68 static int outputNoTablespaces = 0;
76 struct option cmdopts[] = {
77 {
"clean", 0, NULL,
'c'},
78 {
"create", 0, NULL,
'C'},
79 {
"data-only", 0, NULL,
'a'},
80 {
"dbname", 1, NULL,
'd'},
81 {
"exit-on-error", 0, NULL,
'e'},
82 {
"exclude-schema", 1, NULL,
'N'},
83 {
"file", 1, NULL,
'f'},
84 {
"format", 1, NULL,
'F'},
85 {
"function", 1, NULL,
'P'},
86 {
"host", 1, NULL,
'h'},
87 {
"index", 1, NULL,
'I'},
88 {
"jobs", 1, NULL,
'j'},
89 {
"list", 0, NULL,
'l'},
90 {
"no-privileges", 0, NULL,
'x'},
91 {
"no-acl", 0, NULL,
'x'},
92 {
"no-owner", 0, NULL,
'O'},
93 {
"no-reconnect", 0, NULL,
'R'},
94 {
"port", 1, NULL,
'p'},
95 {
"no-password", 0, NULL,
'w'},
96 {
"password", 0, NULL,
'W'},
97 {
"schema", 1, NULL,
'n'},
98 {
"schema-only", 0, NULL,
's'},
99 {
"superuser", 1, NULL,
'S'},
100 {
"table", 1, NULL,
't'},
101 {
"trigger", 1, NULL,
'T'},
102 {
"use-list", 1, NULL,
'L'},
103 {
"username", 1, NULL,
'U'},
104 {
"verbose", 0, NULL,
'v'},
105 {
"single-transaction", 0, NULL,
'1'},
111 {
"enable-row-security",
no_argument, &enable_row_security, 1},
113 {
"no-data-for-failed-tables",
no_argument, &no_data_for_failed_tables, 1},
114 {
"no-tablespaces",
no_argument, &outputNoTablespaces, 1},
139 if (strcmp(argv[1],
"--help") == 0 || strcmp(argv[1],
"-?") == 0)
144 if (strcmp(argv[1],
"--version") == 0 || strcmp(argv[1],
"-V") == 0)
146 puts(
"pg_restore (PostgreSQL) " PG_VERSION);
151 while ((c =
getopt_long(argc, argv,
"acCd:ef:F:h:I:j:lL:n:N:Op:P:RsS:t:T:U:vwWx1",
152 cmdopts, NULL)) != -1)
184 numWorkers = atoi(
optarg);
291 inputFileSpec = argv[
optind++];
293 inputFileSpec = NULL;
298 pg_log_error(
"too many command-line arguments (first is \"%s\")",
300 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"),
308 pg_log_error(
"one of -d/--dbname and -f/--file must be specified");
317 pg_log_error(
"options -d/--dbname and -f/--file cannot be used together");
318 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"),
327 pg_log_error(
"options -s/--schema-only and -a/--data-only cannot be used together");
333 pg_log_error(
"options -c/--clean and -a/--data-only cannot be used together");
343 pg_log_error(
"options -C/--create and -1/--single-transaction cannot be used together");
355 if (numWorkers > MAXIMUM_WAIT_OBJECTS)
358 MAXIMUM_WAIT_OBJECTS);
366 pg_log_error(
"cannot specify both --single-transaction and multiple jobs");
382 pg_log_error(
"option --if-exists requires option -c/--clean");
408 pg_log_error(
"unrecognized archive format \"%s\"; please specify \"c\", \"d\", or \"t\"",
int noDataForFailedTables
SimpleStringList triggerNames
static int no_publications
const char * get_progname(const char *argv0)
#define pg_log_error(...)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
void pg_logging_init(const char *argv0)
Archive * OpenArchive(const char *FileSpec, const ArchiveFormat fmt)
SimpleStringList schemaNames
void on_exit_close_archive(Archive *AHX)
RestoreOptions * NewRestoreOptions(void)
static int disable_triggers
#define required_argument
SimpleStringList tableNames
static void usage(const char *progname)
SimpleStringList functionNames
char * pg_strdup(const char *in)
void PrintTOCSummary(Archive *AH)
void CloseArchive(Archive *AH)
static AmcheckOptions opts
#define exit_nicely(code)
#define PG_TEXTDOMAIN(domain)
void simple_string_list_append(SimpleStringList *list, const char *val)
void set_dump_section(const char *arg, int *dumpSections)
static int no_subscriptions
void init_parallel_dump_utils(void)
static int use_setsessauth
void pg_logging_increase_verbosity(void)
void SortTocFromFile(Archive *AHX)
SimpleStringList indexNames
void set_pglocale_pgservice(const char *argv0, const char *app)
void RestoreArchive(Archive *AH)
void pg_logging_set_level(enum pg_log_level new_level)
void ProcessArchiveRestoreOptions(Archive *AH)
SimpleStringList schemaExcludeNames
static int no_security_labels
#define pg_log_warning(...)
void SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt)