mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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
This commit is contained in:
@ -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;
|
||||
@ -2357,19 +2353,6 @@ icu_validate_locale(const char *loc_str)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
@ -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);
|
||||
|
@ -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',
|
||||
|
@ -1965,7 +1965,7 @@ my %tests = (
|
||||
create_sql =>
|
||||
"CREATE DATABASE dump_test2 LOCALE = 'C' TEMPLATE = template0;",
|
||||
regexp => qr/^
|
||||
\QCREATE DATABASE dump_test2 \E.*\QLOCALE = 'C'\E
|
||||
\QCREATE DATABASE dump_test2 \E.*\QLOCALE = 'C';\E
|
||||
/xm,
|
||||
like => { pg_dumpall_dbprivs => 1, },
|
||||
},
|
||||
|
@ -13,7 +13,7 @@ program_version_ok('createdb');
|
||||
program_options_handling_ok('createdb');
|
||||
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init(extra => ['--locale-provider=libc']);
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
$node->issues_sql_like(
|
||||
|
@ -12,7 +12,7 @@ if ($ENV{with_icu} ne 'yes')
|
||||
}
|
||||
|
||||
my $node1 = PostgreSQL::Test::Cluster->new('node1');
|
||||
$node1->init(extra => ['--locale-provider=libc']);
|
||||
$node1->init;
|
||||
$node1->start;
|
||||
|
||||
$node1->safe_psql('postgres',
|
||||
|
@ -1023,7 +1023,7 @@ SET client_min_messages TO WARNING;
|
||||
do $$
|
||||
BEGIN
|
||||
EXECUTE 'CREATE COLLATION test0 (provider = icu, locale = ' ||
|
||||
quote_literal((SELECT daticulocale FROM pg_database WHERE datname = current_database())) || ');';
|
||||
quote_literal((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) || ');';
|
||||
END
|
||||
$$;
|
||||
CREATE COLLATION test0 FROM "C"; -- fail, duplicate name
|
||||
@ -1031,7 +1031,7 @@ ERROR: collation "test0" already exists
|
||||
do $$
|
||||
BEGIN
|
||||
EXECUTE 'CREATE COLLATION test1 (provider = icu, locale = ' ||
|
||||
quote_literal((SELECT daticulocale FROM pg_database WHERE datname = current_database())) || ');';
|
||||
quote_literal((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) || ');';
|
||||
END
|
||||
$$;
|
||||
RESET client_min_messages;
|
||||
|
@ -362,14 +362,14 @@ SET client_min_messages TO WARNING;
|
||||
do $$
|
||||
BEGIN
|
||||
EXECUTE 'CREATE COLLATION test0 (provider = icu, locale = ' ||
|
||||
quote_literal((SELECT daticulocale FROM pg_database WHERE datname = current_database())) || ');';
|
||||
quote_literal((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) || ');';
|
||||
END
|
||||
$$;
|
||||
CREATE COLLATION test0 FROM "C"; -- fail, duplicate name
|
||||
do $$
|
||||
BEGIN
|
||||
EXECUTE 'CREATE COLLATION test1 (provider = icu, locale = ' ||
|
||||
quote_literal((SELECT daticulocale FROM pg_database WHERE datname = current_database())) || ');';
|
||||
quote_literal((SELECT CASE WHEN datlocprovider='i' THEN daticulocale ELSE datcollate END FROM pg_database WHERE datname = current_database())) || ');';
|
||||
END
|
||||
$$;
|
||||
|
||||
|
Reference in New Issue
Block a user