Re: make tsearch use the database default locale
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers@postgresql.org
Date: 2025-10-19T00:29:59Z
Lists: pgsql-hackers
Attachments
- v4-0001-tsearch-use-database-default-collation-for-parsin.patch (text/x-patch) patch v4-0001
- v4-0002-Remove-obsolete-global-database_ctype_is_c.patch (text/x-patch) patch v4-0002
- v4-0003-Make-char2wchar-static.patch (text/x-patch) patch v4-0003
On Fri, 2025-10-17 at 18:15 +0200, Peter Eisentraut wrote:
>
> 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.
I believe the new code does cover this case:
Previously, the code was effectively:
if (prs->usewide && prs->pgwstr != NULL && c > 0x7f)
retirm nonascii
and the new code is:
if (prs->charmaxlen > 1 && locale->ctype_is_c && wc > 0x7f)
return nonascii;
unless I missed something, those are equivalent.
> 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).)
Done.
The rest of the patches are rebased with no other changes. I plan to
commit soon.
Regards,
Jeff Davis
Commits
-
Make char2wchar() static.
- ff53907c3571 19 (unreleased) landed
-
Remove obsolete global database_ctype_is_c.
- 844385d12e75 19 (unreleased) landed
-
tsearch: use database default collation for parsing.
- e113f9c102b7 19 (unreleased) landed
-
Add pg_database_locale() to retrieve database default locale.
- e533524b23b8 19 (unreleased) landed
-
Add pg_iswxdigit(), useful for tsearch.
- 67a8b49e96ca 19 (unreleased) landed
-
Add pg_iswalpha() and related functions.
- af164f31b9f5 19 (unreleased) landed
-
pg_regc_locale.c: rename some static functions.
- 8efe982fe2c5 19 (unreleased) landed