Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
699a0ef7
Commit
699a0ef7
authored
17 years ago
by
Magnus Hagander
Browse files
Options
Downloads
Patches
Plain Diff
Re-allow UTF8 encodings on win32. Since UTF8 is converted to
UTF16 before being used, all (valid) locales will work for this.
parent
2d5b16bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backend/commands/dbcommands.c
+9
-2
9 additions, 2 deletions
src/backend/commands/dbcommands.c
src/bin/initdb/initdb.c
+12
-2
12 additions, 2 deletions
src/bin/initdb/initdb.c
with
21 additions
and
4 deletions
src/backend/commands/dbcommands.c
+
9
−
2
View file @
699a0ef7
...
...
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.20
1
2007/10/1
3 20:18:41 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.20
2
2007/10/1
6 11:30:16 mha
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -258,7 +258,7 @@ createdb(const CreatedbStmt *stmt)
/*
* Check whether encoding matches server locale settings. We allow
* mismatch in t
wo
cases:
* mismatch in t
hree
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"
,
...
...
This diff is collapsed.
Click to expand it.
src/bin/initdb/initdb.c
+
12
−
2
View file @
699a0ef7
...
...
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.14
6
2007/10/16
09:09:11 petere
Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.14
7
2007/10/16
11:30:16 mha
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2840,7 +2840,17 @@ main(int argc, char *argv[])
/* We allow selection of SQL_ASCII --- see notes in createdb() */
if
(
!
(
ctype_enc
==
user_enc
||
ctype_enc
==
PG_SQL_ASCII
||
user_enc
==
PG_SQL_ASCII
))
user_enc
==
PG_SQL_ASCII
#ifdef WIN32
/*
* On win32, if the encoding chosen is UTF8, all locales are OK
* (assuming the actual locale name passed the checks above). This
* is because UTF8 is a pseudo-codepage, that we convert to UTF16
* before doing any operations on, and UTF16 supports all locales.
*/
||
user_enc
==
PG_UTF8
#endif
))
{
fprintf
(
stderr
,
_
(
"%s: encoding mismatch
\n
"
),
progname
);
fprintf
(
stderr
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment