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

Commite5bb0f0

Browse files
committed
Need to use pg_perm_setlocale when setting LC_CTYPE and LC_COLLATE at startup.
Otherwise, the LC_CTYPE/COLLATE setting gets reverted when using plperl, whichleads to incorrect query results and index corruption.This was accidentally broken in the per-database locale patch in 8.4. Pointedout by Andrew Gierth.
1 parent53e7229 commite5bb0f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/backend/utils/init/postinit.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.191 2009/06/11 14:49:05 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.192 2009/07/08 17:53:29 heikki Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -44,6 +44,7 @@
4444
#include"utils/acl.h"
4545
#include"utils/flatfiles.h"
4646
#include"utils/guc.h"
47+
#include"utils/pg_locale.h"
4748
#include"utils/plancache.h"
4849
#include"utils/portal.h"
4950
#include"utils/relcache.h"
@@ -247,14 +248,14 @@ CheckMyDatabase(const char *name, bool am_superuser)
247248
collate=NameStr(dbform->datcollate);
248249
ctype=NameStr(dbform->datctype);
249250

250-
if (setlocale(LC_COLLATE,collate)==NULL)
251+
if (pg_perm_setlocale(LC_COLLATE,collate)==NULL)
251252
ereport(FATAL,
252253
(errmsg("database locale is incompatible with operating system"),
253254
errdetail("The database was initialized with LC_COLLATE \"%s\", "
254255
" which is not recognized by setlocale().",collate),
255256
errhint("Recreate the database with another locale or install the missing locale.")));
256257

257-
if (setlocale(LC_CTYPE,ctype)==NULL)
258+
if (pg_perm_setlocale(LC_CTYPE,ctype)==NULL)
258259
ereport(FATAL,
259260
(errmsg("database locale is incompatible with operating system"),
260261
errdetail("The database was initialized with LC_CTYPE \"%s\", "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp