Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b37e177

Browse files
committed
Make use of additional chklocale.c entries to reject locales that we
cannot support.
1 parent d545967 commit b37e177

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bin/initdb/initdb.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.143 2007/09/28 22:25:49 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.144 2007/09/29 00:14:40 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -2800,13 +2800,26 @@ main(int argc, char *argv[])
28002800
!(pg_strcasecmp(lc_ctype, "C") == 0 ||
28012801
pg_strcasecmp(lc_ctype, "POSIX") == 0))
28022802
{
2803+
/* Hmm, couldn't recognize the locale's codeset */
28032804
fprintf(stderr, _("%s: could not find suitable encoding for locale \"%s\"\n"),
28042805
progname, lc_ctype);
28052806
fprintf(stderr, _("Rerun %s with the -E option.\n"), progname);
28062807
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
28072808
progname);
28082809
exit(1);
28092810
}
2811+
else if (!PG_VALID_BE_ENCODING(ctype_enc))
2812+
{
2813+
/* We recognized it, but it's not a legal server encoding */
2814+
fprintf(stderr,
2815+
_("%s: locale %s requires unsupported encoding %s\n"),
2816+
progname, lc_ctype, pg_encoding_to_char(ctype_enc));
2817+
fprintf(stderr,
2818+
_("Encoding %s is not allowed as a server-side encoding.\n"
2819+
"Rerun %s with a different locale selection.\n"),
2820+
pg_encoding_to_char(ctype_enc), progname);
2821+
exit(1);
2822+
}
28102823
else
28112824
{
28122825
encodingid = encodingid_to_string(ctype_enc);

0 commit comments

Comments
 (0)