On 10/12/21 09:31, Shaozhong SHI wrote:
I tried initcap and found a major problem with it.

What Postgres version?

In version 12 and 14 I get:


Initcap of notemachine is NoteMachine.

select initcap('notemachine');
   initcap
-------------
 Notemachine


Initcap of Sainsbury's Bank is Sainsbury'S bank.

select initcap('Sainsbury''s Bank');
     initcap
------------------
 Sainsbury'S Bank


Which follows the definition here:

https://www.postgresql.org/docs/14/functions-string.html

initcap ( text ) → text

Converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters.


This is not expected.

What is the encoding, collate, ctype for the database?

Can be found in psql using:

\l db_name


Anyway to get around this problem?

Regards,

David


--
Adrian Klaver
adrian.kla...@aklaver.com


Reply via email to