Seaching without accents

Started by Augusto Cesar Castoldiabout 22 years ago6 messagesgeneral
Jump to latest
#1Augusto Cesar Castoldi
castoldi@npd.ufsc.br

How can I configure postgreSQL to search without acents?

Like:

Table “test”

Clumns: name , values:

Test

Test

tést

Tést

SELECT * FROM test WHERE name LIKE “tes%”

And it should return values “tést, test”

Thanks,

Augusto

#2Marco Lazzeri
marcomail@noze.it
In reply to: Augusto Cesar Castoldi (#1)
Re: Seaching without accents

Il mer, 2004-01-28 alle 13:42, Augusto Cesar Castoldi ha scritto:

How can I configure postgreSQL to search without acents?

You have to write queries using TO_ASCII function and 'LATIN 1'
characters encoding.

Example:

SELECT * FROM my_table WHERE TO_ASCII(value, 'LATIN 1') =
TO_ASCII('Vàlùé', 'LATIN 1');

Cheers,
--
Marco Lazzeri

#3Augusto Cesar Castoldi
castoldi@npd.ufsc.br
In reply to: Marco Lazzeri (#2)
Re: Seaching without accents

Ok, but I know that is an away to do it automatic

Without using the function TO_ASCII

Thanks,

Augusto

-----Original Message-----
From: Marco Lazzeri [mailto:marcomail@noze.it]
Sent: Wednesday, January 28, 2004 11:51 AM
To: Augusto Cesar Castoldi
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Seaching without accents

Il mer, 2004-01-28 alle 13:42, Augusto Cesar Castoldi ha scritto:

How can I configure postgreSQL to search without acents?

You have to write queries using TO_ASCII function and 'LATIN 1'
characters encoding.

Example:

SELECT * FROM my_table WHERE TO_ASCII(value, 'LATIN 1') =
TO_ASCII('Vàlùé', 'LATIN 1');

Cheers,
--
Marco Lazzeri

#4Bernd Helmle
mailings@oopsware.de
In reply to: Augusto Cesar Castoldi (#1)
Re: Seaching without accents

Augusto Cesar Castoldi wrote:

SELECT * FROM test WHERE name LIKE �tes%�

And it should return values �t�st, test�

Why not using a regular expression, like this:

yomama=# select * from test;
name
------
test
t�st
t�st
tast
(4 rows)

yomama=# select * from test where name ~ '^t[e��]s';
name
------
test
t�st
t�st
(3 rows)

Bernd

#5James Moe
jimoe@sohnen-moe.com
In reply to: Augusto Cesar Castoldi (#1)
Re: Seaching without accents

Augusto Cesar Castoldi wrote:

How can I configure postgreSQL to search without acents?

Table “test”

Clumns: name , values:
Test
Test
tést
Tést

Since those are actually different characters that only look the
same, you would have to use another approach:
select * from test where name like 't_st%';
or
select * from test where name like 'tést%' or name like 'test%' ...

--
jimoe at sohnen-moe dot com

#6scott.marlowe
scott.marlowe@ihs.com
In reply to: Augusto Cesar Castoldi (#3)
Re: Seaching without accents

On Wed, 28 Jan 2004, Augusto Cesar Castoldi wrote:

Ok, but I know that is an away to do it automatic

Without using the function TO_ASCII

I think certain locales will do this. Haven't used them, just seen them
mentioned.