diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index b31a30550b..883f381f34 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -1012,10 +1012,10 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) dbcollate = src_collate; if (dbctype == NULL) dbctype = src_ctype; - if (dbiculocale == NULL) - dbiculocale = src_iculocale; if (dblocprovider == '\0') dblocprovider = src_locprovider; + if (dbiculocale == NULL && dblocprovider == COLLPROVIDER_ICU) + dbiculocale = src_iculocale; /* Some encodings are client only */ if (!PG_VALID_BE_ENCODING(encoding)) diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index 78733f64d2..e91c1d013d 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -49,6 +49,15 @@ if ($ENV{with_icu} eq 'yes') '--icu-locale=@colNumeric=lower', 'foobarX' ], 'fails for invalid ICU locale'); + + # additional node, which uses the icu provider + my $node2 = PostgreSQL::Test::Cluster->new('icu'); + $node2->init(extra => ['--locale-provider=icu', '--icu-locale=en']); + $node2->start; + + $node2->command_ok( + [ 'createdb', '-T', 'template0', '--locale-provider=libc', 'foobar55' ], + 'create database with libc provider from template database with icu provider'); } else {