|
42 | 42 | * Portions Copyright (c) 1994, Regents of the University of California
|
43 | 43 | * Portions taken from FreeBSD.
|
44 | 44 | *
|
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 $ |
46 | 46 | *
|
47 | 47 | *-------------------------------------------------------------------------
|
48 | 48 | */
|
@@ -2800,13 +2800,26 @@ main(int argc, char *argv[])
|
2800 | 2800 | !(pg_strcasecmp(lc_ctype, "C") == 0 ||
|
2801 | 2801 | pg_strcasecmp(lc_ctype, "POSIX") == 0))
|
2802 | 2802 | {
|
| 2803 | + /* Hmm, couldn't recognize the locale's codeset */ |
2803 | 2804 | fprintf(stderr, _("%s: could not find suitable encoding for locale \"%s\"\n"),
|
2804 | 2805 | progname, lc_ctype);
|
2805 | 2806 | fprintf(stderr, _("Rerun %s with the -E option.\n"), progname);
|
2806 | 2807 | fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
|
2807 | 2808 | progname);
|
2808 | 2809 | exit(1);
|
2809 | 2810 | }
|
| 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 | + } |
2810 | 2823 | else
|
2811 | 2824 | {
|
2812 | 2825 | encodingid = encodingid_to_string(ctype_enc);
|
|
0 commit comments