aboutsummaryrefslogtreecommitdiffstats
path: root/testing/agensgraph/dont-use-locale-a-on-musl.patch
blob: ce61856d4e25d91a5b8e2189e3da34ffc4191223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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