diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 308dc93f63..e0753c1bad 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -908,10 +908,6 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) errmsg("unrecognized locale provider: %s", locproviderstr))); } - if (diculocale && dblocprovider != COLLPROVIDER_ICU) - ereport(ERROR, - (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("ICU locale cannot be specified unless locale provider is ICU"))); if (distemplate && distemplate->arg) dbistemplate = defGetBoolean(distemplate); if (dallowconnections && dallowconnections->arg) @@ -1051,6 +1047,13 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) check_icu_locale(dbiculocale); } + else + { + if (dbiculocale) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("ICU locale cannot be specified unless locale provider is ICU"))); + } /* * Check that the new encoding and locale settings match the source diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index b87d8fc63b..8ed8628db1 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -71,6 +71,10 @@ if ($ENV{with_icu} eq 'yes') $node2->command_ok( [ 'createdb', '-T', 'template0', '--locale-provider=libc', 'foobar55' ], 'create database with libc provider from template database with icu provider'); + + $node2->command_ok( + [ 'createdb', '-T', 'template0', '--icu-locale', 'en-US', 'foobar56' ], + 'create database with icu locale from template database with icu provider'); } else {