aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-09-14 18:55:15 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-09-14 18:55:15 -0400
commit69e31d05b0a33f55aa5d9540917540f5fccb93a7 (patch)
tree2c2a8005f386a988cdea1dec9ec8d90b863015cd
parent2e4eae87d02fef51c42c2028b65d85b9e051f9eb (diff)
downloadpostgresql-69e31d05b0a33f55aa5d9540917540f5fccb93a7.tar.gz
postgresql-69e31d05b0a33f55aa5d9540917540f5fccb93a7.zip
Improve log messages from pg_import_system_collations().
pg_import_system_collations() was a bit inconsistent about how it reported locales (names output by "locale -a") that it didn't make pg_collation entries for. IMV we should print some suitable message for every locale that we reject, except when it matches a pre-existing pg_collation entry. (This is all at DEBUG1 log level, though, so as not to create noise during initdb.) Add messages for the two cases that were previously not logged, namely unrecognized encoding and client-only encoding. Re-word the existing messages to have a consistent style. Anton Voloshin and Tom Lane Discussion: https://postgr.es/m/429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru
-rw-r--r--src/backend/commands/collationcmds.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index 4075f991a03..53fc579f370 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -576,7 +576,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
if (len == 0 || localebuf[len - 1] != '\n')
{
- elog(DEBUG1, "locale name too long, skipped: \"%s\"", localebuf);
+ elog(DEBUG1, "skipping locale with too-long name: \"%s\"", localebuf);
continue;
}
localebuf[len - 1] = '\0';
@@ -590,18 +590,22 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
*/
if (!pg_is_ascii(localebuf))
{
- elog(DEBUG1, "locale name has non-ASCII characters, skipped: \"%s\"", localebuf);
+ elog(DEBUG1, "skipping locale with non-ASCII name: \"%s\"", localebuf);
continue;
}
enc = pg_get_encoding_from_locale(localebuf, false);
if (enc < 0)
{
- /* error message printed by pg_get_encoding_from_locale() */
+ elog(DEBUG1, "skipping locale with unrecognized encoding: \"%s\"",
+ localebuf);
continue;
}
if (!PG_VALID_BE_ENCODING(enc))
- continue; /* ignore locales for client-only encodings */
+ {
+ elog(DEBUG1, "skipping locale with client-only encoding: \"%s\"", localebuf);
+ continue;
+ }
if (enc == PG_SQL_ASCII)
continue; /* C/POSIX are already in the catalog */