agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Initcap works differently with different locale providers
Date: Tue, 05 Aug 2025 16:01:02 +0700
Message-ID: <31964db3672feeb6a527d8f7191d48e1@postgrespro.ru> (raw)
In-Reply-To: <d8eacbeb8194c578a98317b86d7eb2ef0b6eb0e0.camel@j-davis.com>
References: <804cc10ef95d4d3b298e76b181fd9437@postgrespro.ru>
	<0658C8F0-5ED4-4962-A2A3-524B0D899982@gmail.com>
	<9247c1b9531136e15d83511270e8c43bf877c9ca.camel@j-davis.com>
	<cdfa64230784d7e330c1a2a55237b94e@postgrespro.ru>
	<d8eacbeb8194c578a98317b86d7eb2ef0b6eb0e0.camel@j-davis.com>

Jeff Davis wrote at 2025-08-05 03:59:
> One more thing: we should also change it to "... to  upper case (or
> title case) and the rest to lower case...". Title case is for scripts
> that have characters like 'Dž' (U+01C5).

Done based upon second version of previous patch. Again, there are two
versions - the first one has a mention of digraphs, like 'Dž' (U+01C5),
and the second one doesn't. And again, don't know which version is
better - title case without mentioning digraphs could be interpreted
as "don't capitalise articles and prepositions" or just "don't
capitalize articles", since the definition of "title case" is vague.
We have a "write your own function" clause, but still.

Maybe we should add an example of a digraph to the first patch to
make it more clear, if we go that path.

Attachments:

  [text/x-diff] v3-0001-initcap-documentation.patch (1.3K, ../31964db3672feeb6a527d8f7191d48e1@postgrespro.ru/2-v3-0001-initcap-documentation.patch)
  download | inline diff:
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 74a16af04ad..b32ec6e2cea 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -3147,12 +3147,15 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
         <returnvalue>text</returnvalue>
        </para>
        <para>
-        Converts the first letter of each word to upper case and the
-        rest to lower case. When using the <literal>libc</literal> locale
-        provider, words are sequences of alphanumeric characters separated
-        by non-alphanumeric characters; when using the ICU locale provider,
-        words are separated according to
-        <ulink url="https://www.unicode.org/reports/tr29/#Word_Boundaries">Unicode Standard Annex #29</ulink>.
+        Converts the first letter of each word to upper case (or title case
+        if the letter is a digraph) and the rest to lower case.
+       </para>
+       <para>
+        This function is primarily used for convenient
+        display, and the specific result should not be relied upon because of
+        the differences between locale providers and between different
+        ICU versions. If specific word boundary rules are desired,
+        it is recomended to write a custom function.
        </para>
        <para>
         <literal>initcap('hi THOMAS')</literal>


  [text/x-diff] v3-0002-initcap-documentation.patch (1.3K, ../31964db3672feeb6a527d8f7191d48e1@postgrespro.ru/3-v3-0002-initcap-documentation.patch)
  download | inline diff:
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 74a16af04ad..f799b34dca7 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -3147,12 +3147,15 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
         <returnvalue>text</returnvalue>
        </para>
        <para>
-        Converts the first letter of each word to upper case and the
-        rest to lower case. When using the <literal>libc</literal> locale
-        provider, words are sequences of alphanumeric characters separated
-        by non-alphanumeric characters; when using the ICU locale provider,
-        words are separated according to
-        <ulink url="https://www.unicode.org/reports/tr29/#Word_Boundaries">Unicode Standard Annex #29</ulink>.
+        Converts the first letter of each word to upper case (or title case)
+        and the rest to lower case.
+       </para>
+       <para>
+        This function is primarily used for convenient
+        display, and the specific result should not be relied upon because of
+        the differences between locale providers and between different
+        ICU versions. If specific word boundary rules are desired,
+        it is recomended to write a custom function.
        </para>
        <para>
         <literal>initcap('hi THOMAS')</literal>


view thread (16+ messages)  latest in thread

Message-ID: <31964db3672feeb6a527d8f7191d48e1@postgrespro.ru>
Permalink:  ../31964db3672feeb6a527d8f7191d48e1@postgrespro.ru/
Also on:    postgresql.org/message-id/31964db3672feeb6a527d8f7191d48e1@postgrespro.ru

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-docs@postgresql.org
  Cc: o.tselebrovskiy@postgrespro.ru, pgsql@j-davis.com, aekorotkov@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Initcap works differently with different locale providers
  In-Reply-To: <31964db3672feeb6a527d8f7191d48e1@postgrespro.ru>

* 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