aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-02-16 18:50:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-02-16 18:50:40 +0000
commit1ad93b7e4505624a5ded515e93a272aa1ca4a5cf (patch)
treedd1e7684ada253e79d923345eb5ed60df7dd5dc6 /src/backend/utils/init/postinit.c
parentcdbd27cb2359dad1baafb9ed5a80b309177476fe (diff)
downloadpostgresql-1ad93b7e4505624a5ded515e93a272aa1ca4a5cf.tar.gz
postgresql-1ad93b7e4505624a5ded515e93a272aa1ca4a5cf.zip
Defend against starting a non-MULTIBYTE-enabled backend in a database
with encoding other than SQL_ASCII. Per recent discussion in pghackers.
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 91a92f2423e..0f9639de02b 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.80 2001/01/24 19:43:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.81 2001/02/16 18:50:40 tgl Exp $
*
*
*-------------------------------------------------------------------------
@@ -30,6 +30,7 @@
#include "catalog/pg_database.h"
#include "commands/trigger.h"
#include "commands/variable.h" /* for set_default_client_encoding() */
+#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "storage/backendid.h"
#include "storage/proc.h"
@@ -41,9 +42,6 @@
#include "utils/syscache.h"
#include "utils/temprel.h"
-#ifdef MULTIBYTE
-#include "mb/pg_wchar.h"
-#endif
static void ReverifyMyDatabase(const char *name);
static void InitCommunication(void);
@@ -126,10 +124,15 @@ ReverifyMyDatabase(const char *name)
/*
* OK, we're golden. Only other to-do item is to save the MULTIBYTE
- * encoding info out of the pg_database tuple.
+ * encoding info out of the pg_database tuple --- or complain, if we
+ * can't support it.
*/
#ifdef MULTIBYTE
SetDatabaseEncoding(dbform->encoding);
+#else
+ if (dbform->encoding != SQL_ASCII)
+ 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.",
+ dbform->encoding);
#endif
heap_endscan(pgdbscan);