aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2007-10-16 11:30:16 +0000
committerMagnus Hagander <magnus@hagander.net>2007-10-16 11:30:16 +0000
commit699a0ef7bbd7fa563097ad88b73bc3d439e26dc8 (patch)
treee946c43d562075164aca74773d7aa2b727bfb60e /src/backend/commands/dbcommands.c
parent2d5b16bb10ea4954193d7b84c510bef4e660f7c4 (diff)
downloadpostgresql-699a0ef7bbd7fa563097ad88b73bc3d439e26dc8.tar.gz
postgresql-699a0ef7bbd7fa563097ad88b73bc3d439e26dc8.zip
Re-allow UTF8 encodings on win32. Since UTF8 is converted to
UTF16 before being used, all (valid) locales will work for this.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r--src/backend/commands/dbcommands.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index ec0d02be6b6..3090ae0af43 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.201 2007/10/13 20:18:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.202 2007/10/16 11:30:16 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -258,7 +258,7 @@ createdb(const CreatedbStmt *stmt)
/*
* Check whether encoding matches server locale settings. We allow
- * mismatch in two cases:
+ * mismatch in three cases:
*
* 1. ctype_encoding = SQL_ASCII, which means either that the locale
* is C/POSIX which works with any encoding, or that we couldn't determine
@@ -268,12 +268,19 @@ createdb(const CreatedbStmt *stmt)
* This is risky but we have historically allowed it --- notably, the
* regression tests require it.
*
+ * 3. selected encoding is UTF8 and platform is win32. This is because
+ * UTF8 is a pseudo codepage that is supported in all locales since
+ * it's converted to UTF16 before being used.
+ *
* Note: if you change this policy, fix initdb to match.
*/
ctype_encoding = pg_get_encoding_from_locale(NULL);
if (!(ctype_encoding == encoding ||
ctype_encoding == PG_SQL_ASCII ||
+#ifdef WIN32
+ encoding == PG_UTF8 ||
+#endif
(encoding == PG_SQL_ASCII && superuser())))
ereport(ERROR,
(errmsg("encoding %s does not match server's locale %s",