Re: make tsearch use the database default locale - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: make tsearch use the database default locale
Date
Msg-id e0a4b081-550f-45b6-93d1-405a49958884@eisentraut.org
Whole thread Raw
In response to make tsearch use the database default locale  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: make tsearch use the database default locale
List pgsql-hackers
On 08.10.25 00:49, Jeff Davis wrote:
> Previously, tsearch used the database CTYPE for parsing, but that's not
> good because it creates an unnecessary dependency on libc even when the
> user has requested another provider.
> 
> This patch series allows tsearch to use the database default locale for
> parsing. If the database collation is libc, there's no change.

This looks good to me overall.

> * Most of the patches are straightforward, but v1-0005 might need extra
> attention. There are quite a few cases there with subtle distinctions,
> and I might have missed something. For example, in the "C" locale,
> tsearch treats non-ascii characters as alpha, even though the libc
> functions do not do so (I preserved this behavior).

This is indeed a bit mysterious.  AFAICT, the behavior you describe is 
conditional on if (prs->usewide), so it apparently depends also on the 
encoding?  I'm not sure if the new code covers this.

After this patch set, char2wchar() can become a local function in 
pg_locale_libc.c.  (But we still need wchar2char() externally, so maybe 
it's not worth changing this (yes).)




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Change initdb default to the builtin collation provider
Next
From: Tom Lane
Date:
Subject: Re: Inconsistent Behavior of GROUP BY ROLLUP in v17 vs master