Re: Support LIKE with nondeterministic collations

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Support LIKE with nondeterministic collations
Дата
Msg-id fdc379ce-4b88-4357-b622-2ae0ef08e295@eisentraut.org
обсуждение исходный текст
Ответ на Re: Support LIKE with nondeterministic collations  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-hackers
Here is an updated patch for this.

I have added some more documentation based on the discussions, including 
some examples taken directly from the emails here.

One thing I have been struggling with a bit is the correct use of 
LIKE_FALSE versus LIKE_ABORT in the MatchText() code.  I have made some 
small tweaks about this in this version that I think are more correct, 
but it could use another look.  Maybe also some more tests to verify 
this one way or the other.


On 30.04.24 14:39, Daniel Verite wrote:
>     Peter Eisentraut wrote:
> 
>> This patch adds support for using LIKE with nondeterministic
>>   collations.  So you can do things such as
>>
>>      col LIKE 'foo%' COLLATE case_insensitive
> 
> Nice!
> 
>> The pattern is partitioned into substrings at wildcard characters
>> (so 'foo%bar' is partitioned into 'foo', '%', 'bar') and then then
>> whole predicate matches if a match can be found for each partition
>> under the applicable collation
> 
> Trying with a collation that ignores punctuation:
> 
>    postgres=# CREATE COLLATION "ign_punct" (
>      provider = 'icu',
>      locale='und-u-ka-shifted',
>      deterministic = false
>    );
> 
>    postgres=# SELECT '.foo.' like 'foo' COLLATE ign_punct;
>     ?column?
>    ----------
>     t
>    (1 row)
> 
>    postgres=# SELECT '.foo.' like 'f_o' COLLATE ign_punct;
>     ?column?
>    ----------
>     t
>    (1 row)
> 
>    postgres=# SELECT '.foo.' like '_oo' COLLATE ign_punct;
>     ?column?
>    ----------
>     f
>    (1 row)
> 
> The first two results look fine, but the next one is inconsistent.

Вложения

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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: walsender.c comment with no context is hard to understand
Следующее
От: Tatsuro Yamada
Дата:
Сообщение: Re: Showing applied extended statistics in explain Part 2