MarcosBarroso
asked on
Accent insensitive queries in PostgreSQL
In some SGBD (ex: SQLServer, Firebird), it possible to inform that a database, a table or a column is accent insensitive (or case insensitive).
All queries then become automatically accent (or case) insensitive (using any standard clauses: LIKE, IN, CONTANING, =, >, <, <>, ...)
Is there a way to do this in PostgreSQL ?
All queries then become automatically accent (or case) insensitive (using any standard clauses: LIKE, IN, CONTANING, =, >, <, <>, ...)
Is there a way to do this in PostgreSQL ?
In PostgreSQL all database, table and column names are case insensitive by default (are converted to lower case respectively). You have to quote database, table and column names if you want them to be treated case sensitive.
ASKER
I mean accent insensitive (and case insensitive) search in database data, not database definition.
you need to convert your query to lowercase and search on lowercase-converted field..
To be not case sensitive you need to use ILIKE instead of LIKE
regards
regards
ASKER
My biggest problem in PostgreSQL is with accent insensitive queries, that are easy to do in others SGBD (ex: Firebird, SQLServer).
In these SGBD, when configured to be accent insensitive, a query like :
SELECT name FROM customers WHERE name='JOSÉ'
Could return:
JOSE
JOSÉ
I am not finding any way to do this query in PostgreSQL.
Marcos
In these SGBD, when configured to be accent insensitive, a query like :
SELECT name FROM customers WHERE name='JOSÉ'
Could return:
JOSE
JOSÉ
I am not finding any way to do this query in PostgreSQL.
Marcos
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.