From fca07aca51fb7979f19180712707233ff0e6f4b4 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Sat, 16 Sep 2017 13:36:25 -0700 Subject: [PATCH] Allow ICU to use SortSupport on Windows with utf-8. There is no reason to ever prevent the use of SortSupport on Windows when ICU locales are used. We previously avoided SortSupport on Windows with utf-8 server encoding and a non C-locale due to restrictions in Windows' libc functionality. This is now considered to be a restriction in one platform's libc collation provider, and not a more general platform restriction. --- src/backend/utils/adt/varlena.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index ebfb823..ad8ebed 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -1828,7 +1828,8 @@ varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar) * utf-8 and we are not using the C collation, complex hacks are required. * We don't currently have a comparator that handles that case, so we fall * back on the slow method of having the sort code invoke bttextcmp() (in - * the case of text) via the fmgr trampoline. + * the case of text) via the fmgr trampoline. (ICU locales work just the + * same on Windows, however.) */ if (lc_collate_is_c(collid)) { @@ -1840,7 +1841,8 @@ varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar) collate_c = true; } #ifdef WIN32 - else if (GetDatabaseEncoding() == PG_UTF8) + else if (GetDatabaseEncoding() == PG_UTF8 && + !(locale && locale->provider == COLLPROVIDER_ICU)) return; #endif else -- 2.7.4