casting Bangla characters to NUMERIC

From: Bob Jolliffe <bobjolliffe(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: casting Bangla characters to NUMERIC
Date: 2019-11-25 16:02:32
Message-ID: CACd=f9e+D_m=hTm9fV-hoMG4CDjo6qw0Z4Uk3peUhCOR=O+caA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I have an interesting problem. I have a string field in a table which
(sometimes) is expected to contain numeric values ie. a cast of the
field to INTEGER is supposed to succeed.

My issue is that the application is running in Bangladesh, and
sometimes the users have entered values using Bangla characters. eg.
"৮" rather than "8". (Note that this shouldnt have been possible to
enter in the first place, but we can ignore that for now. They are
there, I have to somehow deal with it.)

Is there a way with LOCALE settings to get this cast to work
correctly? Currently I get:
postgres=# select cast('৮' as INTEGER);
ERROR: invalid input syntax for integer: "৮"
LINE 1: select cast('৮' as INTEGER);

Regards
Bob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-11-25 16:27:40 Re: casting Bangla characters to NUMERIC
Previous Message Adrian Klaver 2019-11-25 14:46:40 Re: Pgadmin 4 schema visibility