diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 65000e5a083..273c92044a4 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -319,7 +319,7 @@ extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt, DataDirSyncMethod sync_method); /* The --list option */ -extern void PrintTOCSummary(Archive *AHX, bool append_data); +extern void PrintTOCSummary(Archive *AHX); extern RestoreOptions *NewRestoreOptions(void); diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index b8b07562069..21595e6dd6f 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -1268,7 +1268,7 @@ ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId, /* Public */ void -PrintTOCSummary(Archive *AHX, bool append_data) +PrintTOCSummary(Archive *AHX) { ArchiveHandle *AH = (ArchiveHandle *) AHX; RestoreOptions *ropt = AH->public.ropt; @@ -1284,7 +1284,7 @@ PrintTOCSummary(Archive *AHX, bool append_data) sav = SaveOutput(AH); if (ropt->filename) - SetOutput(AH, ropt->filename, out_compression_spec, append_data); + SetOutput(AH, ropt->filename, out_compression_spec, false); if (strftime(stamp_str, sizeof(stamp_str), PGDUMP_STRFTIME_FMT, localtime(&AH->createDate)) == 0) diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index 8a78a52fb09..5295129313b 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -122,7 +122,7 @@ main(int argc, char **argv) bool data_only = false; bool schema_only = false; int n_errors = 0; - bool globals_only = false; + bool globals_only = false; SimpleStringList db_exclude_patterns = {NULL, NULL}; struct option cmdopts[] = { @@ -559,14 +559,13 @@ main(int argc, char **argv) * This will restore one database using toc.dat file. * dbname is the current to be restored database name. * - * returns, number of errors while doing restore. + * returns the number of errors while doing restore. */ static int restoreOneDatabase(const char *inputFileSpec, RestoreOptions *opts, int numWorkers, bool append_data, const char *dbname) { Archive *AH; - int n_errors = 0; AH = OpenArchive(inputFileSpec, opts->format); @@ -593,21 +592,17 @@ restoreOneDatabase(const char *inputFileSpec, RestoreOptions *opts, AH->numWorkers = numWorkers; if (opts->tocSummary) - PrintTOCSummary(AH, append_data); + PrintTOCSummary(AH); else { ProcessArchiveRestoreOptions(AH); RestoreArchive(AH, append_data); } - /* return number of errors */ - if (AH->n_errors) - n_errors = AH->n_errors; - /* AH may be freed in CloseArchive? */ CloseArchive(AH); - return n_errors; + return AH->n_errors; } static void @@ -1163,7 +1158,7 @@ restoreAllDatabases(PGconn *conn, const char *dumpdirpath, if (n_errors) { n_errors_total += n_errors; - pg_log_warning("errors ignored on \"%s\" database restore: %d", dboid_cell->db_name, n_errors); + pg_log_warning("errors ignored on database \"%s\" restore: %d", dboid_cell->db_name, n_errors); } dboid_cell = dboid_cell->next; @@ -1193,7 +1188,7 @@ restoreAllDatabases(PGconn *conn, const char *dumpdirpath, * Semicolon is considered as statement terminator. If outfile is passed, then * this will copy all sql commands into outfile rather then executing them. * - * returns, number of errors while processing global.dat + * returns the number of errors while processing global.dat */ static int process_global_sql_commands(PGconn *conn, const char *dumpdirpath, const char *outfile)