Skip to content

Commit 8148e71

Browse files
committed
Fix lc_collate_is_c() when LC_COLLATE != LC_CTYPE.
An unfortunate typo in commit 2d819a0 can cause wrong results when the default collation provider is libc, LC_CTYPE=C, and LC_COLLATE is a real locale. Users with this combination of settings must REINDEX all affected indexes. The same typo can also cause performance degradation when LC_COLLATE=C and LC_CTYPE is a real locale. Problem does not exist in master (due to refactoring), so fix only in version 17. Reported-by: Drew Callahan Discussion: https://postgr.es/m/d5081a7f4f6d425c28dd69d1e09b2e78f149e726.camel@j-davis.com
1 parent b7467ab commit 8148e71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,9 @@ lc_collate_is_c(Oid collation)
13701370
}
13711371
else if (default_locale.provider == COLLPROVIDER_LIBC)
13721372
{
1373-
localeptr = setlocale(LC_CTYPE, NULL);
1373+
localeptr = setlocale(LC_COLLATE, NULL);
13741374
if (!localeptr)
1375-
elog(ERROR, "invalid LC_CTYPE setting");
1375+
elog(ERROR, "invalid LC_COLLATE setting");
13761376
}
13771377
else
13781378
elog(ERROR, "unexpected collation provider '%c'",

0 commit comments

Comments
 (0)