0

Background: I am using PostgreSQL 11 on CentOS. I have a database having UTF-8 encoding, in specific tables I have some Latin characters as follows [ÄéÒçòý]

Objective: I want to replace those with standard English characters for that I am trying to use the following query to list down those specific characters but getting all characters set :

SELECT name_0 from public.gadm36_0_iso2_iso3 where name_0 ~ '[[:alpha:]]'; 

enter image description here

I am searching on my side and referring to some posts as well.

Any help/any suggestions would be great !!!

Sunil
  • 183
  • 4
  • 11

2 Answers2

1

Perhaps you are looking for unaccent:

CREATE EXTENSION unaccent;

SELECT unaccent('ÄéÒçòý');

 unaccent 
----------
 AeOcoy
(1 row)
Laurenz Albe
  • 167,868
  • 16
  • 137
  • 184
1

You can use regular expressions for this

SELECT 'ÄéÒçòý' ~* '\A[A-Z0-9]*\Z';

The output should be false for the above SQL statement. So use this in your where clause.

Sanket Sardesai
  • 339
  • 4
  • 6