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

Commit5e00913

Browse files
committed
Fix varstr_cmp's special case for UTF8 encoding on Windows so that strings
that are reported as "equal" by wcscoll() are checked to see if they reallyare bitwise equal, and are sorted per strcmp() if not. We made this happena couple of years ago in the regular code path, but it unaccountably gotleft out of the Windows/UTF8 case (probably brain fade on my part at thetime). As in the prior set of changes, affected users may need to reindexindexes on textual columns.Backpatch as far as 8.2, which is the oldest release we are still supportingon Windows.
1 parent3e701a0 commit5e00913

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.162 2008/01/01 19:45:53 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.163 2008/03/13 18:31:56 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1003,6 +1003,19 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2)
10031003
ereport(ERROR,
10041004
(errmsg("could not compare Unicode strings: %m")));
10051005

1006+
/*
1007+
* In some locales wcscoll() can claim that nonidentical strings
1008+
* are equal. Believing that would be bad news for a number of
1009+
* reasons, so we follow Perl's lead and sort "equal" strings
1010+
* according to strcmp (on the UTF-8 representation).
1011+
*/
1012+
if (result==0)
1013+
{
1014+
result=strncmp(arg1,arg2,Min(len1,len2));
1015+
if ((result==0)&& (len1!=len2))
1016+
result= (len1<len2) ?-1 :1;
1017+
}
1018+
10061019
if (a1p!=a1buf)
10071020
pfree(a1p);
10081021
if (a2p!=a2buf)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp