unaccent

A contrib module for removing accents from words

unaccent is a contrib module providing a filtering dictionary for removing accents from words.

unaccent was added in PostgreSQL 9.0.

Usage

unaccent provides a single function, unaccent(),  which in the default installation can be used to remove accents (diacritical marks) common in many European languages based on the Roman alphabet.

unaccent is implemented on top of PostgreSQL's built-in full text search, and the extension creates a text search template and dictionary. This also makes it possible to provide a custom set of unaccenting rules; see the documentation for further details.

The built-in function to_ascii() provides a simpler and more limited equivalent.

Change history

Examples

Create the extension:

postgres=# CREATE EXTENSION unaccent;
CREATE EXTENSION

This creates a text search dictionary "unacccent"; here we are assuming the extension is installed in the default public schema:

postgres=# \dFd public.*
List of text search dictionaries
 Schema |   Name   | Description 
--------+----------+-------------
 public | unaccent | 
(1 row)

Basic usage:

postgres=# SELECT unaccent('überbewertete äthiopische Ödnis');
            unaccent             
---------------------------------
 uberbewertete athiopische Odnis
(1 row)

Categories

Contrib module, Locale and character set handling

See also

full text search, to_ascii()