From 41eb2906100d62caf554b5b3c3fd5ff7bd807f82 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <andreas@proxel.se>
Date: Fri, 29 Nov 2024 00:55:41 +0100
Subject: [PATCH v10 01/11] Move check for ucol_strcollUTF8 to pg_locale_icu.c

The result of the check is only used by pg_locale_icu.c.
---
 src/backend/utils/adt/pg_locale_icu.c | 12 ++++++++++++
 src/include/utils/pg_locale.h         | 13 -------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/backend/utils/adt/pg_locale_icu.c b/src/backend/utils/adt/pg_locale_icu.c
index 73eb430d750..2c6b950ec18 100644
--- a/src/backend/utils/adt/pg_locale_icu.c
+++ b/src/backend/utils/adt/pg_locale_icu.c
@@ -14,6 +14,18 @@
 #ifdef USE_ICU
 #include <unicode/ucnv.h>
 #include <unicode/ustring.h>
+
+/*
+ * ucol_strcollUTF8() was introduced in ICU 50, but it is buggy before ICU 53.
+ * (see
+ * <https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org>)
+ */
+#if U_ICU_VERSION_MAJOR_NUM >= 53
+#define HAVE_UCOL_STRCOLLUTF8 1
+#else
+#undef HAVE_UCOL_STRCOLLUTF8
+#endif
+
 #endif
 
 #include "access/htup_details.h"
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index 4d2262b39aa..776f8f6f2fe 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -16,19 +16,6 @@
 #include <unicode/ucol.h>
 #endif
 
-#ifdef USE_ICU
-/*
- * ucol_strcollUTF8() was introduced in ICU 50, but it is buggy before ICU 53.
- * (see
- * <https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org>)
- */
-#if U_ICU_VERSION_MAJOR_NUM >= 53
-#define HAVE_UCOL_STRCOLLUTF8 1
-#else
-#undef HAVE_UCOL_STRCOLLUTF8
-#endif
-#endif
-
 /* use for libc locale names */
 #define LOCALE_NAME_BUFLEN 128
 
-- 
2.34.1

