]> granicus.if.org Git - postgresql/commitdiff
Fix ICU collation use on Windows
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Jun 2017 14:08:54 +0000 (10:08 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Jun 2017 14:08:54 +0000 (10:08 -0400)
Windows uses a separate code path for libc locales.  The code previously
ended up there also if an ICU collation should be used, leading to a
crash.

Reported-by: Ashutosh Sharma <ashu.coek88@gmail.com>
src/backend/utils/adt/varlena.c

index a0dd391f092c054d79f96ad88363d800eba534a2..a21c689959602a2e0e16f09823d638587ebae787 100644 (file)
@@ -1433,7 +1433,8 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
 
 #ifdef WIN32
                /* Win32 does not have UTF-8, so we need to map to UTF-16 */
-               if (GetDatabaseEncoding() == PG_UTF8)
+               if (GetDatabaseEncoding() == PG_UTF8
+                       && (!mylocale || mylocale->provider == COLLPROVIDER_LIBC))
                {
                        int                     a1len;
                        int                     a2len;