I think in this case it's not really related, as I'm not trying to copy options from the base locale.
It all seems to come from some missing information on the official icu4c docs. When describing the parameters of ucol_openRules() it says:
"strength: The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY, UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules"
RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules,
int32_t strength,
UColAttributeValue decompositionMode,
UParseError *outParseError, UnicodeString *outReason,
UErrorCode &errorCode) {
...
// Set attributes after building the collator,
// to keep the default settings consistent with the rule string.
if(strength != UCOL_DEFAULT) {
setAttribute(UCOL_STRENGTH, static_cast<UColAttributeValue>(strength), errorCode);
}
...
}
Which not only implies that UCOL_DEFAULT is a valid argument, but also that if you don't pass UCOL_DEFAULT any 'strength' options will be overridden. So it seems that the 'make_icu_collator' function inside postgres should use UCOL_DEFAULT, to allow the rules to set the desired strength level, instead of the current UCOL_DEFAULT_STRENGTH argument.
On 11.01.25 18:27, PG Bug reporting form wrote:
> When using the 'rules' option of CREATE COLLATION to create a custom icu
> collation it seems that, if you include inside the rules a change to the
> comparison strength, it is ignored.
I think this is the same as this ICU bug:
https://unicode-org.atlassian.net/browse/ICU-22456