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

Commit1ad93b7

Browse files
committed
Defend against starting a non-MULTIBYTE-enabled backend in a database
with encoding other than SQL_ASCII. Per recent discussion in pghackers.
1 parentcdbd27c commit1ad93b7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.80 2001/01/24 19:43:16 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.81 2001/02/16 18:50:40 tgl Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -30,6 +30,7 @@
3030
#include"catalog/pg_database.h"
3131
#include"commands/trigger.h"
3232
#include"commands/variable.h"/* for set_default_client_encoding() */
33+
#include"mb/pg_wchar.h"
3334
#include"miscadmin.h"
3435
#include"storage/backendid.h"
3536
#include"storage/proc.h"
@@ -41,9 +42,6 @@
4142
#include"utils/syscache.h"
4243
#include"utils/temprel.h"
4344

44-
#ifdefMULTIBYTE
45-
#include"mb/pg_wchar.h"
46-
#endif
4745

4846
staticvoidReverifyMyDatabase(constchar*name);
4947
staticvoidInitCommunication(void);
@@ -126,10 +124,15 @@ ReverifyMyDatabase(const char *name)
126124

127125
/*
128126
* OK, we're golden. Only other to-do item is to save the MULTIBYTE
129-
* encoding info out of the pg_database tuple.
127+
* encoding info out of the pg_database tuple --- or complain, if we
128+
* can't support it.
130129
*/
131130
#ifdefMULTIBYTE
132131
SetDatabaseEncoding(dbform->encoding);
132+
#else
133+
if (dbform->encoding!=SQL_ASCII)
134+
elog(FATAL,"database was initialized with MULTIBYTE encoding %d,\n\tbut the backend was compiled without multibyte support.\n\tlooks like you need to initdb or recompile.",
135+
dbform->encoding);
133136
#endif
134137

135138
heap_endscan(pgdbscan);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp