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

Commit6dcb185

Browse files
committed
Back-patch "Tolerate version lookup failure for old style Windows locale names."
If users provide old style pre-standardized Windows locale names in aCREATE COLLATION command, the OS is unable to provide versioninformation. Continue without capturing version information, ratherthan exposing an OS error.This was originally done in commit9f12a3b for 14 only, to supportfuture features that might encounter old style names from initdb'sdefault. It wasn't done in 13 because I didn't consider that usersmight actually want to use the old format explicitly (something weshould consider blocking in a future release with a better errormessage, but that's not a policy we've decided on yet).Back-patch to 13, based on the field complaint in pgsql-bugs #17058.Reported-by: Yasushi Yamashita <developer@yamashi-ta.jp>Discussion:https://postgr.es/m/17058-b49f5793c912c5aa%40postgresql.org
1 parent33af10c commit6dcb185

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,10 +1743,22 @@ get_collation_actual_version(char collprovider, const char *collcollate)
17431743
MultiByteToWideChar(CP_ACP,0,collcollate,-1,wide_collcollate,
17441744
LOCALE_NAME_MAX_LENGTH);
17451745
if (!GetNLSVersionEx(COMPARE_STRING,wide_collcollate,&version))
1746+
{
1747+
/*
1748+
* GetNLSVersionEx() wants a language tag such as "en-US", not a
1749+
* locale name like "English_United States.1252". Until those
1750+
* values can be prevented from entering the system, or 100%
1751+
* reliably converted to the more useful tag format, tolerate the
1752+
* resulting error and report that we have no version data.
1753+
*/
1754+
if (GetLastError()==ERROR_INVALID_PARAMETER)
1755+
returnNULL;
1756+
17461757
ereport(ERROR,
17471758
(errmsg("could not get collation version for locale \"%s\": error code %lu",
17481759
collcollate,
17491760
GetLastError())));
1761+
}
17501762
collversion=psprintf("%d.%d,%d.%d",
17511763
(version.dwNLSVersion >>8)&0xFFFF,
17521764
version.dwNLSVersion&0xFF,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp