summaryrefslogtreecommitdiff
path: root/src/bin/initdb
diff options
context:
space:
mode:
authorJeff Davis2023-06-21 18:10:03 +0000
committerJeff Davis2023-06-21 18:10:03 +0000
commit2535c74b1a6190cc42e13f6b6b55d94bff4b7dd6 (patch)
treecbcc0270e62e44f582ade6691b1011cdf0f30845 /src/bin/initdb
parent555b929bbe7bd2f228e804d2c5bf4a246a319358 (diff)
initdb: change default --locale-provider back to libc.
Reverts 27b62377b4. Discussion: https://postgr.es/m/eff031036baa07f325de29215371a4c9e69d61f3.camel@j-davis.com Discussion: https://postgr.es/m/3353947.1682092131@sss.pgh.pa.us
Diffstat (limited to 'src/bin/initdb')
-rw-r--r--src/bin/initdb/initdb.c23
-rw-r--r--src/bin/initdb/t/001_initdb.pl5
2 files changed, 6 insertions, 22 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 71a3d26c378..fa3af0d75c5 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -143,11 +143,7 @@ static char *lc_monetary = NULL;
static char *lc_numeric = NULL;
static char *lc_time = NULL;
static char *lc_messages = NULL;
-#ifdef USE_ICU
-static char locale_provider = COLLPROVIDER_ICU;
-#else
static char locale_provider = COLLPROVIDER_LIBC;
-#endif
static char *icu_locale = NULL;
static char *icu_rules = NULL;
static const char *default_text_search_config = NULL;
@@ -2358,19 +2354,6 @@ icu_validate_locale(const char *loc_str)
}
/*
- * Determine the default ICU locale
- */
-static char *
-default_icu_locale(void)
-{
-#ifdef USE_ICU
- return pg_strdup(uloc_getDefault());
-#else
- pg_fatal("ICU is not supported in this build");
-#endif
-}
-
-/*
* set up the locale variables
*
* assumes we have called setlocale(LC_ALL, "") -- see set_pglocale_pgservice
@@ -2429,10 +2412,7 @@ setlocales(void)
/* acquire default locale from the environment, if not specified */
if (icu_locale == NULL)
- {
- icu_locale = default_icu_locale();
- printf(_("Using default ICU locale \"%s\".\n"), icu_locale);
- }
+ pg_fatal("ICU locale must be specified");
/* canonicalize to a language tag */
langtag = icu_language_tag(icu_locale);
@@ -3273,7 +3253,6 @@ main(int argc, char *argv[])
break;
case 8:
locale = "C";
- locale_provider = COLLPROVIDER_LIBC;
break;
case 9:
pwfilename = pg_strdup(optarg);
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl
index 8b4acb7148e..2d7469d2fc3 100644
--- a/src/bin/initdb/t/001_initdb.pl
+++ b/src/bin/initdb/t/001_initdb.pl
@@ -103,6 +103,11 @@ SKIP:
if ($ENV{with_icu} eq 'yes')
{
+ command_fails_like(
+ [ 'initdb', '--no-sync', '--locale-provider=icu', "$tempdir/data2" ],
+ qr/initdb: error: ICU locale must be specified/,
+ 'locale provider ICU requires --icu-locale');
+
command_ok(
[
'initdb', '--no-sync',