Hello,
I have run into an issue where specifying the rules argument for "CREATE COLLATION" changes the collation strength to
tertiary,even if it is explicitly set in the rules string. I discovered that this is because ucol_openRules is called
passingstrength UCOL_DEFAULT_STRENGTH, which overwrites whatever is in the rules string with UCOL_TERTIARY.
This fix changes this call to pass UCOL_DEFAULT instead. This way, UCOL_TERTIARY is still specified by default, but the
strengthexplicitly set on the rules string is not overwritten. This is important because there is currently no way to
createa collation with custom tailoring rules with strengh other than tertiary.
What happens currently:
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '', deterministic = false); -- strengh: tertiary
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '[strength 2]', deterministic = false); -- strength:
tertiary
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '[strength 1]', deterministic = false); -- strength:
tertiary
What happens after the patch:
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '', deterministic = false); -- strengh: tertiary
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '[strength 2]', deterministic = false); -- strength:
secondary
CREATE COLLATION my_col (provider = icu, locale = 'und', rules = '[strength 1]', deterministic = false); -- strength:
primary
As this only affects cases where the strength is explicitly set but was previously ignores, I do not think it is a
breakingchange.
I have successfully compiled and tested PostgreSQL after this change, and it behaves as documented above.
Thank you in advance,
Luis