BUG #19425: Parametric settings in collation not working in rule syntax

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #19425: Parametric settings in collation not working in rule syntax
Дата
Msg-id 19425-58915e19dacd4f40@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #19425: Parametric settings in collation not working in rule syntax
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19425
Logged by:          Dorian
Email address:      dorian.752@live.fr
PostgreSQL version: 18.3
Operating system:   Windows
Description:

Hello,

I want to create a custom collation with settings and tailoring rules, but I
ran into an issue.

When I create a custom collation, I first used collation settings in the
local, giving me something like this :
CREATE COLLATION IF NOT EXISTS und_ci_ai1(
    provider = icu,
    locale = 'und-u-ka-shifted-kc-false-ks-level1',
    deterministic = false
);

For instance, I can do this request and I will get the result '1' :
SELECT 1 WHERE 'adm' LIKE 'Adm' COLLATE und_ci_ai1;

But, I also want to add a tailoring rule. For the simplicity we will say
that I want to add 'p < q'
CREATE COLLATION IF NOT EXISTS und_ci_ai2(
    provider = icu,
    locale = 'und-u-ka-shifted-kc-false-ks-level1',
    deterministic = false,
    rules = $$
        & 'p' < 'q'
    $$
);

But, and this is my problem, the previous request doesn't seem to work
anymore. It doesn't return '1' :
SELECT 1 WHERE 'adm' LIKE 'Adm' COLLATE und_ci_ai2;

For this request to return '1', I have to add 'a' = 'A' like this :
rules = $$
        & 'p' < 'q'
        & 'a' = 'A'
$$

I didn't see in the documentation that I can't use settings in locale AND
tailoring rules at the same time. But just in case I tried to use parametric
settings in the rules syntax.
Unfortunately, it doesn't seem to work at all, the request still doesn't
return '1' :
CREATE COLLATION IF NOT EXISTS und_ci_ai3(
    provider = icu,
    locale = 'und',
    deterministic = false,
    rules = $$
        [strength 1]
        [caseLevel off]
    $$
);

SELECT 1 WHERE 'adm' LIKE 'Adm' COLLATE und_ci_ai3;

I hope I gave you all the infos you need. Thank you for your time.

Here the documentations I used :
https://www.postgresql.org/docs/current/collation.html#ICU-COLLATION-SETTINGS
https://www.unicode.org/reports/tr35/tr35-collation.html#Setting_Options
https://unicode-org.github.io/icu/userguide/collation/customization/





В списке pgsql-bugs по дате отправления: