On 22.10.22 03:22, Thomas Munro wrote:
I'd love to hear others' thoughts on how we can turn this into a
workable solution.  Hopefully while staying simple...

I played with this patch a bit.  It looks like a reasonable approach.

Attached is a small patch to get the dynamic libicu* lookup working with the library naming on macOS.

Instead of packing the ICU version into the locale field ('63:en'), I would make it a separate field in pg_collation and a separate argument in CREATE COLLATION.

At this point, perhaps it would be good to start building some tests to demonstrate various upgrade scenarios and to ensure portability.

From e236f5257bf0bf3e7b83b9d9b095d1d0e3fdc971 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Fri, 11 Nov 2022 15:44:44 +0100
Subject: [PATCH] fixup! WIP: Multi-version ICU.

---
 src/backend/utils/adt/pg_locale.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/backend/utils/adt/pg_locale.c 
b/src/backend/utils/adt/pg_locale.c
index 666a79b907a4..3ffb9706ff99 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1600,6 +1600,10 @@ get_icu_library(int major_version)
                                 "%s%sicui18n%d." DLSUFFIX,
                                 icu_library_path,
                                 icu_library_path[0] ? "\\" : "",
+#elif defined(__darwin__)
+                                "%s%slibicui18n.%d" DLSUFFIX,
+                                icu_library_path,
+                                icu_library_path[0] ? "/" : "",
 #else
                                 "%s%slibicui18n" DLSUFFIX ".%d",
                                 icu_library_path,
@@ -1615,6 +1619,10 @@ get_icu_library(int major_version)
                                 "%s%sicuuc%d." DLSUFFIX,
                                 icu_library_path,
                                 icu_library_path[0] ? "\\" : "",
+#elif defined(__darwin__)
+                                "%s%slibicuuc.%d" DLSUFFIX,
+                                icu_library_path,
+                                icu_library_path[0] ? "/" : "",
 #else
                                 "%s%slibicuuc" DLSUFFIX ".%d",
                                 icu_library_path,
-- 
2.38.1

Reply via email to