Re: Fault with initcap - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Fault with initcap
Date
Msg-id 10fbeda1-606a-553b-3598-eca814f40bb7@aklaver.com
Whole thread Raw
In response to Fault with initcap  (Shaozhong SHI <shishaozhong@gmail.com>)
Responses Re: Fault with initcap
List pgsql-general
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.klaver@aklaver.com



pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: Avg/max size of these JSON docs in Postgres
Next
From: Karsten Hilbert
Date:
Subject: Aw: Re: Re: Fault with initcap