31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
From: Jakub Jirutka <jakub@jirutka.cz>
|
|
Date: Wed, 03 Aug 2022 20:40:33 +0200
|
|
Subject: [PATCH] Don't generate collations based on locale(1)
|
|
|
|
When the PostgreSQL cluster is initialized (using initdb(1)) or the
|
|
DB administrator calls `pg_import_system_collations()` directly, this
|
|
function creates COLLATIONs in the system catalog (pg_collations).
|
|
If the locale(1) command is available, this function creates COLLATIONs
|
|
based on the `locale -a` output.
|
|
|
|
The locale(1) command is normally not available on Alpine Linux, so it
|
|
does nothing and only the default and ICU-based COLLATIONs are created.
|
|
However, there's a musl-locales package that provides locale(1), but it
|
|
doesn't implement any collations. This package just provides locale
|
|
translations. So if the user happens to have locale(1) installed and they
|
|
initialize the cluster or call `pg_import_system_collations()`, they end
|
|
up with dozens of libc-based COLLATIONs in the system catalog that
|
|
actually do not work! They will all behave like "C", because musl libc
|
|
doesn't implement locales.
|
|
|
|
--- a/src/backend/commands/collationcmds.c
|
|
+++ b/src/backend/commands/collationcmds.c
|
|
@@ -401,7 +401,7 @@
|
|
|
|
|
|
/* will we use "locale -a" in pg_import_system_collations? */
|
|
-#if defined(HAVE_LOCALE_T) && !defined(WIN32)
|
|
+#if defined(HAVE_LOCALE_T) && !defined(WIN32) && defined(__GLIBC__) // XXX-Patched
|
|
#define READ_LOCALE_A_OUTPUT
|
|
#endif
|
|
|