João Paulo Batistella dijo:
> Hi!
>
> I have, in the same column, accented words and not.
> But I don´t want to worry about it.
>
> Imagine the table Person:
> CREATE TABLE PERSON (name TEXT)
>
> INSERT INTO PERSON VALUES ('José')
> INSERT INTO PERSON VALUES ('Jose')
>
> The following statement
> SELECT * FROM PERSON WHERE NAME like 'José'
> would return only the first row, because 'José' is an
> accented word.
I think you have two ways of solving this:
1. using regular expressions with character classes where an accented
letter is found:
SELECT * FROM PERSON WHERE name ~* '^Jos[eé]$'
(note the anchoring to make it equivalent to the absence of % in
LIKE)
2. using a function to convert the accented letters in strings. Then
use it like
SELECT * FROM PERSON WHERE drop_accents(name) LIKE
drop_accents('José')
--
Alvaro Herrera (<alvherre[a]atentus.com>)
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)