From: Peter Eisentraut Date: Wed, 23 Aug 2017 00:32:17 +0000 (-0400) Subject: pg_upgrade: Message translatability and style fixes X-Git-Tag: REL_10_BETA4~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ac307bc0125235f124e45bb697d5b445f0118ca;p=postgresql pg_upgrade: Message translatability and style fixes --- diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 11f804b7e8..327c78e879 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -62,13 +62,15 @@ output_check_banner(bool live_check) { if (user_opts.check && live_check) { - pg_log(PG_REPORT, "Performing Consistency Checks on Old Live Server\n"); - pg_log(PG_REPORT, "------------------------------------------------\n"); + pg_log(PG_REPORT, + "Performing Consistency Checks on Old Live Server\n" + "------------------------------------------------\n"); } else { - pg_log(PG_REPORT, "Performing Consistency Checks\n"); - pg_log(PG_REPORT, "-----------------------------\n"); + pg_log(PG_REPORT, + "Performing Consistency Checks\n" + "-----------------------------\n"); } } @@ -991,7 +993,7 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster) bool found = false; char output_path[MAXPGPATH]; - prep_status("Checking for JSONB user data types"); + prep_status("Checking for incompatible jsonb data type"); snprintf(output_path, sizeof(output_path), "tables_using_jsonb.txt"); @@ -1022,7 +1024,7 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster) " a.atttypid = 'pg_catalog.jsonb'::pg_catalog.regtype AND " " c.relnamespace = n.oid AND " /* exclude possible orphaned temp tables */ - " n.nspname !~ '^pg_temp_' AND " + " n.nspname !~ '^pg_temp_' AND " " n.nspname NOT IN ('pg_catalog', 'information_schema')"); ntups = PQntuples(res); @@ -1057,8 +1059,8 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster) if (found) { pg_log(PG_REPORT, "fatal\n"); - pg_fatal("Your installation contains one of the JSONB data types in user tables.\n" - "The internal format of JSONB changed during 9.4 beta so this cluster cannot currently\n" + pg_fatal("Your installation contains the \"jsonb\" data type in user tables.\n" + "The internal format of \"jsonb\" changed during 9.4 beta so this cluster cannot currently\n" "be upgraded. You can remove the problem tables and restart the upgrade. A list\n" "of the problem columns is in the file:\n" " %s\n\n", output_path); @@ -1078,7 +1080,7 @@ check_for_pg_role_prefix(ClusterInfo *cluster) PGresult *res; PGconn *conn = connectToServer(cluster, "template1"); - prep_status("Checking for roles starting with 'pg_'"); + prep_status("Checking for roles starting with \"pg_\""); res = executeQueryOrDie(conn, "SELECT * " @@ -1088,9 +1090,9 @@ check_for_pg_role_prefix(ClusterInfo *cluster) if (PQntuples(res) != 0) { if (cluster == &old_cluster) - pg_fatal("The source cluster contains roles starting with 'pg_'\n"); + pg_fatal("The source cluster contains roles starting with \"pg_\"\n"); else - pg_fatal("The target cluster contains roles starting with 'pg_'\n"); + pg_fatal("The target cluster contains roles starting with \"pg_\"\n"); } PQclear(res); diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c index cc4b4078db..cb8e29b17c 100644 --- a/src/bin/pg_upgrade/exec.c +++ b/src/bin/pg_upgrade/exec.c @@ -307,7 +307,7 @@ check_single_dir(const char *pg_data, const char *subdir) report_status(PG_FATAL, "check for \"%s\" failed: %s\n", subDirName, strerror(errno)); else if (!S_ISDIR(statBuf.st_mode)) - report_status(PG_FATAL, "%s is not a directory\n", + report_status(PG_FATAL, "\"%s\" is not a directory\n", subDirName); } @@ -370,7 +370,7 @@ check_bin_dir(ClusterInfo *cluster) report_status(PG_FATAL, "check for \"%s\" failed: %s\n", cluster->bindir, strerror(errno)); else if (!S_ISDIR(statBuf.st_mode)) - report_status(PG_FATAL, "%s is not a directory\n", + report_status(PG_FATAL, "\"%s\" is not a directory\n", cluster->bindir); validate_exec(cluster->bindir, "postgres"); diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c index 8383b75325..063a94f0ca 100644 --- a/src/bin/pg_upgrade/function.c +++ b/src/bin/pg_upgrade/function.c @@ -252,7 +252,7 @@ check_loadable_libraries(void) if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) pg_fatal("could not open file \"%s\": %s\n", output_path, strerror(errno)); - fprintf(script, _("could not load library \"%s\":\n%s\n"), + fprintf(script, _("could not load library \"%s\": %s"), lib, PQerrorMessage(conn)); } diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index ef9793f3bd..2a68ce6efa 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -104,8 +104,10 @@ main(int argc, char **argv) check_new_cluster(); report_clusters_compatible(); - pg_log(PG_REPORT, "\nPerforming Upgrade\n"); - pg_log(PG_REPORT, "------------------\n"); + pg_log(PG_REPORT, + "\n" + "Performing Upgrade\n" + "------------------\n"); prepare_new_cluster(); @@ -164,8 +166,10 @@ main(int argc, char **argv) issue_warnings_and_set_wal_level(); - pg_log(PG_REPORT, "\nUpgrade Complete\n"); - pg_log(PG_REPORT, "----------------\n"); + pg_log(PG_REPORT, + "\n" + "Upgrade Complete\n" + "----------------\n"); output_completion_banner(analyze_script_file_name, deletion_script_file_name); diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index 58e3593896..26e60fab46 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -30,7 +30,7 @@ connectToServer(ClusterInfo *cluster, const char *db_name) if (conn == NULL || PQstatus(conn) != CONNECTION_OK) { - pg_log(PG_REPORT, "connection to database failed: %s\n", + pg_log(PG_REPORT, "connection to database failed: %s", PQerrorMessage(conn)); if (conn) @@ -132,7 +132,7 @@ executeQueryOrDie(PGconn *conn, const char *fmt,...) if ((status != PGRES_TUPLES_OK) && (status != PGRES_COMMAND_OK)) { - pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", query, + pg_log(PG_REPORT, "SQL command failed\n%s\n%s", query, PQerrorMessage(conn)); PQclear(result); PQfinish(conn); @@ -281,7 +281,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) if ((conn = get_db_conn(cluster, "template1")) == NULL || PQstatus(conn) != CONNECTION_OK) { - pg_log(PG_REPORT, "\nconnection to database failed: %s\n", + pg_log(PG_REPORT, "\nconnection to database failed: %s", PQerrorMessage(conn)); if (conn) PQfinish(conn); diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c index a9071a3448..524b604296 100644 --- a/src/bin/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -82,7 +82,7 @@ new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, bool check_mode) pg_log(PG_WARNING, "\n" "Your installation contains large objects. The new database has an\n" "additional large object permission table. After upgrading, you will be\n" - "given a command to populate the pg_largeobject permission table with\n" + "given a command to populate the pg_largeobject_metadata table with\n" "default permissions.\n\n"); else pg_log(PG_WARNING, "\n" @@ -115,7 +115,7 @@ old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster) bool found = false; char output_path[MAXPGPATH]; - prep_status("Checking for invalid \"line\" user columns"); + prep_status("Checking for incompatible \"line\" data type"); snprintf(output_path, sizeof(output_path), "tables_using_line.txt"); @@ -390,7 +390,7 @@ old_9_6_invalidate_hash_indexes(ClusterInfo *cluster, bool check_mode) pg_log(PG_WARNING, "\n" "Your installation contains hash indexes. These indexes have different\n" "internal formats between your old and new clusters, so they must be\n" - "reindexed with the REINDEX command. The file:\n" + "reindexed with the REINDEX command. The file\n" " %s\n" "when executed by psql by the database superuser will recreate all invalid\n" "indexes; until then, none of these indexes will be used.\n\n",