Re: postgreSQL UPPER Method is converting the character "µ" into "M"

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Sai Teja <saitejasaichintalapudi(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: postgreSQL UPPER Method is converting the character "µ" into "M"
Date: 2023-09-06 14:21:12
Message-ID: f14b874dfa12ecbdb05d0f9c773cfe18a0ff8977.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2023-09-06 at 19:34 +0530, Sai Teja wrote:
> Actually we are migrating the data from DB2 to postgreSQL. So in DB2 the upper method is converting µ as µ only but not as M.

Then you are using a different collation in DB2, or "upper" (which is not standardized,
as far as I know), is defined differently there.

> So, while validating the data we have encountered this problem.
>
> We want to have the data in both DB's should be similar (db2 and postgreSQL)
>
> In my local it is windows OS and locale is English_united_states.1252 and in local it is converting as expected ( testµ into TESTµ)
>
> So, even I want to change locale i cannot change now. Since already db is created. BTW this db is hosted in azure.
>
> Would request to please suggest if any alternatives are there to resolve this issue. 

Specify a collation that does what you want explicitly:

SELECT upper('testµ' COLLATE "C");

upper
═══════
TESTµ
(1 row)

But then don't complain if your "ö" and "é" are not uppercased either.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2023-09-06 14:23:28 Re: postgreSQL UPPER Method is converting the character "µ" into "M"
Previous Message Sai Teja 2023-09-06 14:04:40 Re: postgreSQL UPPER Method is converting the character "µ" into "M"