From: Peter Eisentraut Date: Thu, 9 Mar 2023 07:09:40 +0000 (+0100) Subject: Disallow specifying ICU rules unless locale provider is ICU X-Git-Tag: REL_16_BETA1~583 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=544b452a5a598dd14d7a38d15a778932e58d18b0;p=thirdparty%2Fpostgresql.git Disallow specifying ICU rules unless locale provider is ICU Follow-up for 30a53b7929; this was not checked in all cases. Reported-by: Jeff Davis --- diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c index c51e3afdb4c..8949684afe1 100644 --- a/src/backend/commands/collationcmds.c +++ b/src/backend/commands/collationcmds.c @@ -271,6 +271,11 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("nondeterministic collations not supported with this provider"))); + if (collicurules && collprovider != COLLPROVIDER_ICU) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("ICU rules cannot be specified unless locale provider is ICU"))); + if (collprovider == COLLPROVIDER_ICU) { #ifdef USE_ICU diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 7063a5a7ed5..4d5d5d68666 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -1066,6 +1066,11 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("ICU locale cannot be specified unless locale provider is ICU"))); + + if (dbicurules) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("ICU rules cannot be specified unless locale provider is ICU"))); } /*