Seaching without accents

Started by Augusto Cesar Castoldialmost 22 years ago4 messages
#1Augusto Cesar Castoldi
castoldi@npd.ufsc.br

How can I configure postgreSQL to search without acents?

Is PostgreSQL have this support?

I configured my locale to pt_BR, that support acents, create table with
enconding "latin1", but nothing works. I know that I can use function
"TO_ASCII", and "select like "t_s%".

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

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

On Mon, 2 Feb 2004, Augusto Cesar Castoldi wrote:

How can I configure postgreSQL to search without acents?

Is PostgreSQL have this support?

I configured my locale to pt_BR, that support acents, create table with
enconding "latin1", but nothing works. I know that I can use function
"TO_ASCII", and "select like "t_s%".

Like:

Table �test�
Clumns: name , values:
Test
Test
t�st
T�st

Did you run initdb with --locale=pt_BR

??? It's got to be done at initdb time, after that it's too late to
change it.

#3Augusto Cesar Castoldi
castoldi@npd.ufsc.br
In reply to: scott.marlowe (#2)
RES: Seaching without accents

Yes,

I tried to initdb isso locale too.

Didn’t worked, now my linux is configured with pt_BR, than in initdb
appers there, "using locale pt_BR"

Why it doesn't work? Did you tried it?

Is there something related with "Indexes" ? Do I need to create one? If
I create an Index, it will save the rows in 'index' without acents?

Thanks,

Augusto

-----Mensagem original-----
De: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] Em nome de scott.marlowe
Enviada em: Monday, February 02, 2004 9:52 PM
Para: Augusto Cesar Castoldi
Cc: pgsql-hackers@postgresql.org
Assunto: Re: [HACKERS] Seaching without accents

On Mon, 2 Feb 2004, Augusto Cesar Castoldi wrote:

How can I configure postgreSQL to search without acents?

Is PostgreSQL have this support?

I configured my locale to pt_BR, that support acents, create table

with

enconding "latin1", but nothing works. I know that I can use function
"TO_ASCII", and "select like "t_s%".

Like:

Table “test”
Clumns: name , values:
Test
Test
tést
Tést

Did you run initdb with --locale=pt_BR

??? It's got to be done at initdb time, after that it's too late to
change it.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

#4Euler Taveira de Oliveira
euler@ufgnet.ufg.br
In reply to: Augusto Cesar Castoldi (#1)
Re: Seaching without accents

Hi Augusto,

How can I configure postgreSQL to search without acents?
Is PostgreSQL have this support?

There isn't a specific function in postgresql. Maybe you could implement it in PL/Perl or any other PL/* language.

SELECT * FROM test WHERE name LIKE _tes%_

And it should return values _tést, test_

It's not a good idea to use _ to replace accents 'cause it would match undesirable expressions like tost, tist, tust, txst, etc.

--
Euler Taveira de Oliveira
euler (at) ufgnet.ufg.br
Desenvolvedor Web e Administrador de Sistemas
UFGNet - Universidade Federal de Goiás