From: Anton Voloshin <a.voloshin@postgrespro.ru>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: missing warning in pg_import_system_collations
Date: Thu, 9 Sep 2021 13:45:05 +0700
Message-ID: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru> (raw)
Hello hackers,
In pg_import_system_collations() there is this fragment of code:
enc = pg_get_encoding_from_locale(localebuf, false);
if (enc < 0)
{
/* error message printed by pg_get_encoding_from_locale() */
continue;
}
However, false passed to pg_get_encoding_from_locale() means
write_message argument is false, so no error message is ever printed.
I propose an obvious patch (see attachment).
Introduced in aa17c06fb in January 2017 when debug was replaced by
false, so I guess back-patching through 10 would be appropriate.
--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ruAttachments:pg_import_system_collations-warning.patch (text/x-patch, 521B) downloaddiff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.cindex 4075f991a03..b601ca4d68c 100644--- a/src/backend/commands/collationcmds.c+++ b/src/backend/commands/collationcmds.c@@ -594,7 +594,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
continue;
}
- enc = pg_get_encoding_from_locale(localebuf, false);+ enc = pg_get_encoding_from_locale(localebuf, /*write_message=*/true);
if (enc < 0)
{
/* error message printed by pg_get_encoding_from_locale() */
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: a.voloshin@postgrespro.ru
Subject: Re: missing warning in pg_import_system_collations
In-Reply-To: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru>
References: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox