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.ru
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index 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 via email to