public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniel Verite <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Support LIKE with nondeterministic collations
Date: Tue, 30 Apr 2024 14:39:11 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

	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.


Best regards,
-- 
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Support LIKE with nondeterministic collations
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox