From 455d745ed7e6df09c3ada22c34bc5a888ef02304 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Fri, 24 Jan 2025 09:49:55 +0800
Subject: [PATCH v12 1/2] coesmetic change.

---
 src/bin/pg_dump/common_dumpall_restore.h |  9 +++---
 src/bin/pg_dump/pg_dumpall.c             |  2 +-
 src/bin/pg_dump/pg_restore.c             | 39 ++++++++++++------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/bin/pg_dump/common_dumpall_restore.h b/src/bin/pg_dump/common_dumpall_restore.h
index a27c3e9fb8..aef7abdf4f 100644
--- a/src/bin/pg_dump/common_dumpall_restore.h
+++ b/src/bin/pg_dump/common_dumpall_restore.h
@@ -16,11 +16,10 @@
 
 #include "pg_backup.h"
 
-extern PGconn *connectDatabase(const char *dbname,
-		const char *connection_string, const char *pghost,
-		const char *pgport, const char *pguser,
-		trivalue prompt_password, bool fail_on_error,
-		const char *progname, const char **connstr, int *server_version);
+extern PGconn *v(const char *dbname, const char *connection_string, const char *pghost,
+							   const char *pgport, const char *pguser,
+							   trivalue prompt_password, bool fail_on_error,
+							   const char *progname, const char **connstr, int *server_version);
 extern  PGresult *executeQuery(PGconn *conn, const char *query);
 extern ArchiveFormat parseDumpFormat(const char *format);
 #endif                          /* COMMON_DUMPALL_RESTORE_H */
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 5915b1b051..5adeeb6d4d 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -673,7 +673,7 @@ help(void)
 	printf(_("\nGeneral options:\n"));
 	printf(_("  -f, --file=FILENAME          output file name\n"));
 	printf(_("  -F, --format=c|d|t|p         output file format (custom, directory, tar,\n"
-			"                                plain text (default))\n"));
+			 "                                plain text (default))\n"));
 	printf(_("  -v, --verbose                verbose mode\n"));
 	printf(_("  -V, --version                output version information, then exit\n"));
 	printf(_("  --lock-wait-timeout=TIMEOUT  fail after waiting TIMEOUT for a table lock\n"));
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 79f61395ae..a715448dce 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -77,8 +77,8 @@ simple_db_oid_list_append(SimpleDatabaseOidList *list, Oid db_oid, const char *d
 static void usage(const char *progname);
 static void read_restore_filters(const char *filename, RestoreOptions *opts);
 static bool IsFileExistsInDirectory(const char *dir, const char *filename);
-static bool restoreOneDatabase(const char *inputFileSpec,
-		RestoreOptions *opts, int numWorkers, bool append_data);
+static bool restoreOneDatabase(const char *inputFileSpec, RestoreOptions *opts,
+							   int numWorkers, bool append_data);
 static int ReadOneStatement(StringInfo inBuf, FILE *pfile);
 static int restoreAllDatabases(PGconn *conn, const char *dumpdirpath,
 	SimpleStringList db_exclude_patterns, RestoreOptions *opts, int numWorkers);
@@ -87,14 +87,15 @@ static void execute_global_sql_commands(PGconn *conn, const char *dumpdirpath,
 static int filter_dbnames_for_restore(PGconn *conn,
 		SimpleDatabaseOidList *dbname_oid_list, SimpleStringList db_exclude_patterns);
 static int get_dbname_oid_list_from_mfile(const char *dumpdirpath,
-		SimpleDatabaseOidList *dbname_oid_list);
+										  SimpleDatabaseOidList *dbname_oid_list);
 static void simple_db_oid_list_append(SimpleDatabaseOidList *list, Oid db_oid,
-		const char *dbname);
+									  const char *dbname);
 static bool is_full_pattern(PGconn *conn, const char *str, const char *ptrn);
 static void simple_string_full_list_delete(SimpleStringList *list);
 static void simple_db_oid_full_list_delete(SimpleDatabaseOidList *list);
 static void simple_db_oid_list_delete(SimpleDatabaseOidList *list,
-		SimpleDatabaseOidListCell *cell, SimpleDatabaseOidListCell *prev);
+									  SimpleDatabaseOidListCell *cell,
+									  SimpleDatabaseOidListCell *prev);
 
 int
 main(int argc, char **argv)
@@ -446,8 +447,8 @@ main(int argc, char **argv)
 		/* Plain format is not supported for pg_restore. */
 		if (opts->format == archNull)
 		{
-			pg_fatal("unrecognized archive format \"%s\"; please specify \"c\", \"d\", or \"t\"",
-					opts->formatName);
+			pg_fatal("unrecognized archive format \"%s\", one of \"c\", \"d\" or \"t\" must be specified",
+					  opts->formatName);
 		}
 	}
 
@@ -458,7 +459,7 @@ main(int argc, char **argv)
 	 * --exclude-database patterns.
 	 */
 	if (inputFileSpec != NULL &&
-			!IsFileExistsInDirectory(inputFileSpec, "toc.dat"))
+		!IsFileExistsInDirectory(inputFileSpec, "toc.dat"))
 	{
 		/* If global.dat is exist, then process it. */
 		if (IsFileExistsInDirectory(pg_strdup(inputFileSpec), "global.dat"))
@@ -470,8 +471,8 @@ main(int argc, char **argv)
 			if (opts->cparams.dbname)
 			{
 				conn = connectDatabase(opts->cparams.dbname, NULL, opts->cparams.pghost,
-						opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT, false,
-						progname, NULL, NULL);
+									   opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT,
+									   false, progname, NULL, NULL);
 
 				if (!conn)
 					pg_fatal("could not connect to database \"%s\"", opts->cparams.dbname);
@@ -498,8 +499,8 @@ main(int argc, char **argv)
 			simple_string_full_list_delete(&db_exclude_patterns);
 
 			return exit_code;
-		}/* end if */
-	}/* end if */
+		}
+	}
 
 	return restoreOneDatabase(inputFileSpec, opts, numWorkers, false);
 }
@@ -511,7 +512,7 @@ main(int argc, char **argv)
  */
 static bool
 restoreOneDatabase(const char *inputFileSpec, RestoreOptions *opts,
-		int numWorkers, bool append_data)
+				   int numWorkers, bool append_data)
 {
 	Archive		*AH;
 	bool		exit_code;
@@ -955,20 +956,20 @@ restoreAllDatabases(PGconn *conn, const char *dumpdirpath,
 
 	if (!conn)
 	{
-		pg_log_info("trying to connect postgres database to dump into out file");
+		pg_log_info("trying to connect database \"postgres\"  to dump into out file");
 
 		conn = connectDatabase("postgres", NULL, opts->cparams.pghost,
-				opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT, false,
-				progname, NULL, NULL);
+							   opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT,
+							   false, progname, NULL, NULL);
 
 		/* Try with template1. */
 		if (!conn)
 		{
-			pg_log_info("trying to connect template1 database as failed to connect to postgres to dump into out file");
+			pg_log_info("trying to connect database \"template1\" as failed to connect to database \"postgres\" to dump into out file");
 
 			conn = connectDatabase("template1", NULL, opts->cparams.pghost,
-					opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT, false,
-					progname, NULL, NULL);
+								   opts->cparams.pgport, opts->cparams.username, TRI_DEFAULT,
+								   false, progname, NULL, NULL);
 
 			if (!conn)
 				pg_log_info("there is no database connection so consider pattern as simple name for exclude-database");
-- 
2.34.1

