Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2ac307b

Browse files
committed
pg_upgrade: Message translatability and style fixes
1 parent adce891 commit 2ac307b

File tree

6 files changed

+30
-24
lines changed

6 files changed

+30
-24
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ output_check_banner(bool live_check)
6262
{
6363
if (user_opts.check && live_check)
6464
{
65-
pg_log(PG_REPORT, "Performing Consistency Checks on Old Live Server\n");
66-
pg_log(PG_REPORT, "------------------------------------------------\n");
65+
pg_log(PG_REPORT,
66+
"Performing Consistency Checks on Old Live Server\n"
67+
"------------------------------------------------\n");
6768
}
6869
else
6970
{
70-
pg_log(PG_REPORT, "Performing Consistency Checks\n");
71-
pg_log(PG_REPORT, "-----------------------------\n");
71+
pg_log(PG_REPORT,
72+
"Performing Consistency Checks\n"
73+
"-----------------------------\n");
7274
}
7375
}
7476

@@ -991,7 +993,7 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
991993
bool found = false;
992994
char output_path[MAXPGPATH];
993995

994-
prep_status("Checking for JSONB user data types");
996+
prep_status("Checking for incompatible jsonb data type");
995997

996998
snprintf(output_path, sizeof(output_path), "tables_using_jsonb.txt");
997999

@@ -1022,7 +1024,7 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
10221024
" a.atttypid = 'pg_catalog.jsonb'::pg_catalog.regtype AND "
10231025
" c.relnamespace = n.oid AND "
10241026
/* exclude possible orphaned temp tables */
1025-
" n.nspname !~ '^pg_temp_' AND "
1027+
" n.nspname !~ '^pg_temp_' AND "
10261028
" n.nspname NOT IN ('pg_catalog', 'information_schema')");
10271029

10281030
ntups = PQntuples(res);
@@ -1057,8 +1059,8 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
10571059
if (found)
10581060
{
10591061
pg_log(PG_REPORT, "fatal\n");
1060-
pg_fatal("Your installation contains one of the JSONB data types in user tables.\n"
1061-
"The internal format of JSONB changed during 9.4 beta so this cluster cannot currently\n"
1062+
pg_fatal("Your installation contains the \"jsonb\" data type in user tables.\n"
1063+
"The internal format of \"jsonb\" changed during 9.4 beta so this cluster cannot currently\n"
10621064
"be upgraded. You can remove the problem tables and restart the upgrade. A list\n"
10631065
"of the problem columns is in the file:\n"
10641066
" %s\n\n", output_path);
@@ -1078,7 +1080,7 @@ check_for_pg_role_prefix(ClusterInfo *cluster)
10781080
PGresult *res;
10791081
PGconn *conn = connectToServer(cluster, "template1");
10801082

1081-
prep_status("Checking for roles starting with 'pg_'");
1083+
prep_status("Checking for roles starting with \"pg_\"");
10821084

10831085
res = executeQueryOrDie(conn,
10841086
"SELECT * "
@@ -1088,9 +1090,9 @@ check_for_pg_role_prefix(ClusterInfo *cluster)
10881090
if (PQntuples(res) != 0)
10891091
{
10901092
if (cluster == &old_cluster)
1091-
pg_fatal("The source cluster contains roles starting with 'pg_'\n");
1093+
pg_fatal("The source cluster contains roles starting with \"pg_\"\n");
10921094
else
1093-
pg_fatal("The target cluster contains roles starting with 'pg_'\n");
1095+
pg_fatal("The target cluster contains roles starting with \"pg_\"\n");
10941096
}
10951097

10961098
PQclear(res);

src/bin/pg_upgrade/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ check_single_dir(const char *pg_data, const char *subdir)
307307
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
308308
subDirName, strerror(errno));
309309
else if (!S_ISDIR(statBuf.st_mode))
310-
report_status(PG_FATAL, "%s is not a directory\n",
310+
report_status(PG_FATAL, "\"%s\" is not a directory\n",
311311
subDirName);
312312
}
313313

@@ -370,7 +370,7 @@ check_bin_dir(ClusterInfo *cluster)
370370
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
371371
cluster->bindir, strerror(errno));
372372
else if (!S_ISDIR(statBuf.st_mode))
373-
report_status(PG_FATAL, "%s is not a directory\n",
373+
report_status(PG_FATAL, "\"%s\" is not a directory\n",
374374
cluster->bindir);
375375

376376
validate_exec(cluster->bindir, "postgres");

src/bin/pg_upgrade/function.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ check_loadable_libraries(void)
252252
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
253253
pg_fatal("could not open file \"%s\": %s\n",
254254
output_path, strerror(errno));
255-
fprintf(script, _("could not load library \"%s\":\n%s\n"),
255+
fprintf(script, _("could not load library \"%s\": %s"),
256256
lib,
257257
PQerrorMessage(conn));
258258
}

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ main(int argc, char **argv)
104104
check_new_cluster();
105105
report_clusters_compatible();
106106

107-
pg_log(PG_REPORT, "\nPerforming Upgrade\n");
108-
pg_log(PG_REPORT, "------------------\n");
107+
pg_log(PG_REPORT,
108+
"\n"
109+
"Performing Upgrade\n"
110+
"------------------\n");
109111

110112
prepare_new_cluster();
111113

@@ -164,8 +166,10 @@ main(int argc, char **argv)
164166

165167
issue_warnings_and_set_wal_level();
166168

167-
pg_log(PG_REPORT, "\nUpgrade Complete\n");
168-
pg_log(PG_REPORT, "----------------\n");
169+
pg_log(PG_REPORT,
170+
"\n"
171+
"Upgrade Complete\n"
172+
"----------------\n");
169173

170174
output_completion_banner(analyze_script_file_name,
171175
deletion_script_file_name);

src/bin/pg_upgrade/server.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ connectToServer(ClusterInfo *cluster, const char *db_name)
3030

3131
if (conn == NULL || PQstatus(conn) != CONNECTION_OK)
3232
{
33-
pg_log(PG_REPORT, "connection to database failed: %s\n",
33+
pg_log(PG_REPORT, "connection to database failed: %s",
3434
PQerrorMessage(conn));
3535

3636
if (conn)
@@ -132,7 +132,7 @@ executeQueryOrDie(PGconn *conn, const char *fmt,...)
132132

133133
if ((status != PGRES_TUPLES_OK) && (status != PGRES_COMMAND_OK))
134134
{
135-
pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", query,
135+
pg_log(PG_REPORT, "SQL command failed\n%s\n%s", query,
136136
PQerrorMessage(conn));
137137
PQclear(result);
138138
PQfinish(conn);
@@ -281,7 +281,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
281281
if ((conn = get_db_conn(cluster, "template1")) == NULL ||
282282
PQstatus(conn) != CONNECTION_OK)
283283
{
284-
pg_log(PG_REPORT, "\nconnection to database failed: %s\n",
284+
pg_log(PG_REPORT, "\nconnection to database failed: %s",
285285
PQerrorMessage(conn));
286286
if (conn)
287287
PQfinish(conn);

src/bin/pg_upgrade/version.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, bool check_mode)
8282
pg_log(PG_WARNING, "\n"
8383
"Your installation contains large objects. The new database has an\n"
8484
"additional large object permission table. After upgrading, you will be\n"
85-
"given a command to populate the pg_largeobject permission table with\n"
85+
"given a command to populate the pg_largeobject_metadata table with\n"
8686
"default permissions.\n\n");
8787
else
8888
pg_log(PG_WARNING, "\n"
@@ -115,7 +115,7 @@ old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster)
115115
bool found = false;
116116
char output_path[MAXPGPATH];
117117

118-
prep_status("Checking for invalid \"line\" user columns");
118+
prep_status("Checking for incompatible \"line\" data type");
119119

120120
snprintf(output_path, sizeof(output_path), "tables_using_line.txt");
121121

@@ -390,7 +390,7 @@ old_9_6_invalidate_hash_indexes(ClusterInfo *cluster, bool check_mode)
390390
pg_log(PG_WARNING, "\n"
391391
"Your installation contains hash indexes. These indexes have different\n"
392392
"internal formats between your old and new clusters, so they must be\n"
393-
"reindexed with the REINDEX command. The file:\n"
393+
"reindexed with the REINDEX command. The file\n"
394394
" %s\n"
395395
"when executed by psql by the database superuser will recreate all invalid\n"
396396
"indexes; until then, none of these indexes will be used.\n\n",

0 commit comments

Comments
 (0)