Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6dda099

Browse files
committed
Allow ICU to use SortSupport on Windows with UTF-8
There is no reason to ever prevent the use of SortSupport on Windowswhen ICU locales are used. We previously avoided SortSupport on Windowswith UTF-8 server encoding and a non C-locale due to restrictions inWindows' libc functionality.This is now considered to be a restriction in one platform's libccollation provider, and not a more general platform restriction.Reported-by: Peter Geoghegan <pg@bowt.ie>
1 parent9b31c72 commit6dda099

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

‎src/backend/utils/adt/varlena.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,12 +1823,6 @@ varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar)
18231823
* requirements of BpChar callers. However, if LC_COLLATE = C, we can
18241824
* make things quite a bit faster with varstrfastcmp_c or bpcharfastcmp_c,
18251825
* both of which use memcmp() rather than strcoll().
1826-
*
1827-
* There is a further exception on Windows. When the database encoding is
1828-
* UTF-8 and we are not using the C collation, complex hacks are required.
1829-
* We don't currently have a comparator that handles that case, so we fall
1830-
* back on the slow method of having the sort code invoke bttextcmp() (in
1831-
* the case of text) via the fmgr trampoline.
18321826
*/
18331827
if (lc_collate_is_c(collid))
18341828
{
@@ -1839,14 +1833,8 @@ varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar)
18391833

18401834
collate_c= true;
18411835
}
1842-
#ifdefWIN32
1843-
elseif (GetDatabaseEncoding()==PG_UTF8)
1844-
return;
1845-
#endif
18461836
else
18471837
{
1848-
ssup->comparator=varstrfastcmp_locale;
1849-
18501838
/*
18511839
* We need a collation-sensitive comparison. To make things faster,
18521840
* we'll figure out the collation based on the locale id and cache the
@@ -1867,6 +1855,22 @@ varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar)
18671855
}
18681856
locale=pg_newlocale_from_collation(collid);
18691857
}
1858+
1859+
/*
1860+
* There is a further exception on Windows. When the database
1861+
* encoding is UTF-8 and we are not using the C collation, complex
1862+
* hacks are required. We don't currently have a comparator that
1863+
* handles that case, so we fall back on the slow method of having the
1864+
* sort code invoke bttextcmp() (in the case of text) via the fmgr
1865+
* trampoline. ICU locales work just the same on Windows, however.
1866+
*/
1867+
#ifdefWIN32
1868+
if (GetDatabaseEncoding()==PG_UTF8&&
1869+
!(locale&&locale->provider==COLLPROVIDER_ICU))
1870+
return;
1871+
#endif
1872+
1873+
ssup->comparator=varstrfastcmp_locale;
18701874
}
18711875

18721876
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp