Re: how to ignore accents? - Mailing list pgsql-novice

From Ennio-Sr
Subject Re: how to ignore accents?
Date
Msg-id 20050331000145.GA8344@deby.ei.hnet
Whole thread Raw
In response to how to ignore accents?  ("Celia McInnis" <celia@drmath.ca>)
Responses Re: how to ignore accents?
Re: how to ignore accents?
List pgsql-novice
* Celia McInnis <celia@drmath.ca> [300305, 12:29]:
> I have French text with accents in it and would rather (for search purposes)
> be able to search for things with the accents removed. Is there any builtin
> postgres function which will do this?
>
> Here is the format of some accented (French) words in my database:
>
> fran\347ais caf\351 t\364\t br\373le r\352ver \342nes b\350gues
>
> which I want to be able to search for as:
>
> francais cafe tot brule rever anes begues
>
> Celia
>

Hi Celia,

I'm not an expert, but I'm afraid it's not possible to do that (and I'd
be glad if somebody came out saying I'm wrong as I've the same problem).
However, you can achieve a similar result using _like_ and truncating
the accented words so that only un-accented letters are searched for.

In your example, you would use:

mydb=> select * from your_table where col_title like '%franc%';
mydb=> select * from your_table where col_title like '%caf%';
mydb=> select * from your_table where col_title like '%gues%';
and so on.

Hope that helps.
Regards,
    Ennio.


--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: rpm install issues - RHE3
Next
From: Michael Fuhr
Date:
Subject: Re: how to ignore accents?