Re: Accent insensitive search

From: Ian Barwick <barwick(at)gmx(dot)net>
To: Alejandro Javier Pomeraniec <apomeraniec(at)buenosaires(dot)gov(dot)ar>, pgsql-general(at)postgresql(dot)org
Subject: Re: Accent insensitive search
Date: 2003-07-01 19:39:08
Message-ID: 200307012139.08201.barwick@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 01 July 2003 17:11, Alejandro Javier Pomeraniec wrote:
> Hi ! Does anyone knows how to make accent insensitive searches??
>
> For example
>
> i have this data in a table
>
> --------
> Colón
> Polo
> --------
>
> I need that this query
>
> SELECT * FROM testtable WHERE testfield like '%olo%';
>
> brings both results instead of only showing Polo.

One solution[*]:

SELECT * FROM testtable WHERE to_ascii(testfield,'LATIN1') LIKE '%olo%'

Note this might not work with all database encodings, especially UNICODE.

[*] no doubt someone will be along in a moment with another.

Ian Barwick
barwick(at)gmx(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-07-01 19:42:16 Re: Accent insensitive search
Previous Message Stephan Szabo 2003-07-01 16:09:58 Re: updating data but the constraint is set "immediate"