pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support text position search functions with nondeterministic col
Date: Fri, 21 Feb 2025 11:30:24 +0000
Message-ID: <E1tlREg-000SRA-0A@gemulon.postgresql.org> (raw)

Support text position search functions with nondeterministic collations

This allows using text position search functions with nondeterministic
collations.  These functions are

- position, strpos
- replace
- split_part
- string_to_array
- string_to_table

which all use common internal infrastructure.

There was previously no internal implementation of this, so it was met
with a not-supported error.  This adds the internal implementation and
removes the error.

Unlike with deterministic collations, the search cannot use any
byte-by-byte optimized techniques but has to go substring by
substring.  We also need to consider that the found match could have a
different length than the needle and that there could be substrings of
different length matching at a position.  In most cases, we need to
find the longest such substring (greedy semantics), but this can be
configured by each caller.

Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://www.postgresql.org/message-id/flat/582b2613-0900-48ca-8b0d-340c06f4d400@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/329304c9012b2ac6d906afeb18062f9080dceef9

Modified Files
--------------
src/backend/utils/adt/varlena.c                | 104 ++++++++++++++---
src/test/regress/expected/collate.icu.utf8.out | 154 ++++++++++++++++++++-----
src/test/regress/sql/collate.icu.utf8.sql      |  36 +++++-
3 files changed, 246 insertions(+), 48 deletions(-)



Message-ID: <E1tlREg-000SRA-0A@gemulon.postgresql.org>
Permalink:  ../E1tlREg-000SRA-0A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tlREg-000SRA-0A@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Support text position search functions with nondeterministic col
  In-Reply-To: <E1tlREg-000SRA-0A@gemulon.postgresql.org>

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

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