pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Unicode full case mapping: PG_UNICODE_FAST, and standard-compliant UCS_BASIC
Date: Thu, 17 Apr 2025 06:58:41 -0700
Message-ID: <20250417135841.33.nmisch@google.com> (raw)
In-Reply-To: <f9562cf9871805bb4d4bb6675bbd43aabee4f12a.camel@j-davis.com>
References: <ddfd67928818f138f51635712529bc5e1d25e4e7.camel@j-davis.com>
	<179d2b9eb62ce9584177f4c863174c94de9985b7.camel@j-davis.com>
	<548f78d50590dfa119b21128c30c8ded5ce7e69d.camel@j-davis.com>
	<03d1416a974f7349b2415e01e85aac943fc55ba8.camel@j-davis.com>
	<f9562cf9871805bb4d4bb6675bbd43aabee4f12a.camel@j-davis.com>

On Fri, Jan 17, 2025 at 04:06:20PM -0800, Jeff Davis wrote:
> Committed 0001 and 0002.

> Upon reviewing the discussion threads, I removed the Unicode "adjust to
> Cased" behavior when titlecasing. As Peter pointed out[1], it doesn't
> match the documentation or expectations for INITCAP().

While commit d3d0983 changed most of the non-test pg_u_*() "bool posix"
arguments, it left a pg_u_isalnum(u, true) in strtitle_builtin() subroutine
initcap_wbnext().  The above paragraph may or may not be saying that's
intentional.  Example of the consequence at non-ASCII decimal digits:

SELECT
	str,
	re,
	regexp_count(str COLLATE pg_c_utf8, re) AS count_c_utf8,
	regexp_count(str COLLATE pg_unicode_fast, re) AS count_unicode_fast,
	regexp_count(str COLLATE unicode, re) AS count_unicode,
	initcap(str COLLATE pg_c_utf8) AS initcap_c_utf8,
	initcap(str COLLATE pg_unicode_fast) AS initcap_unicode_fast,
	initcap(str COLLATE unicode) AS initcap_unicode
FROM
	(VALUES (U&'foo\0661bar baz')) AS str_t(str),
	(VALUES ('[[:digit:]]')) AS re_t(re)
ORDER BY 1, 2;

str                  │ foo١bar baz
re                   │ [[:digit:]]
count_c_utf8         │ 0
count_unicode_fast   │ 1
count_unicode        │ 1
initcap_c_utf8       │ Foo١Bar Baz
initcap_unicode_fast │ Foo١Bar Baz
initcap_unicode      │ Foo١bar Baz

Should initcap_wbnext() pass in a locale-dependent "bool posix" argument like
the others calls the commit changed?  Related message from the development of
pg_c_utf8, which you shared downthread:
https://www.postgresql.org/message-id/610d7f1b-c68c-4eb8-a03d-1515da304c58%40manitou-mail.org


Long-term, pg_u_isword() should have a "bool posix" argument.  Currently, only
tests call that function.  If it got a non-test caller,
https://www.unicode.org/reports/tr18/#word would have pg_u_isword() follow the
choice of posix compatibility like pg_u_isalnum() does.





view thread (9+ messages)  latest in thread

Message-ID: <20250417135841.33.nmisch@google.com>
Permalink:  ../20250417135841.33.nmisch@google.com/
Also on:    postgresql.org/message-id/20250417135841.33.nmisch@google.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: noah@leadboat.com, pgsql@j-davis.com
  Subject: Re: Unicode full case mapping: PG_UNICODE_FAST, and standard-compliant UCS_BASIC
  In-Reply-To: <20250417135841.33.nmisch@google.com>
  References: <ddfd67928818f138f51635712529bc5e1d25e4e7.camel@j-davis.com> <179d2b9eb62ce9584177f4c863174c94de9985b7.camel@j-davis.com> <548f78d50590dfa119b21128c30c8ded5ce7e69d.camel@j-davis.com> <03d1416a974f7349b2415e01e85aac943fc55ba8.camel@j-davis.com> <f9562cf9871805bb4d4bb6675bbd43aabee4f12a.camel@j-davis.com> <20250417135841.33.nmisch@google.com>

* 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