Contents
unaccent
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
- PostgreSQL 13
- marked as a
trusted extension
(commit eb67623c)
- marked as a
- PostgreSQL 11
- Vietnamese character handling added (commit ec0a69e4)
- PostgreSQL 9.0
- added (commit 92e05bc6)
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)
References
- PostgreSQL documentation: unaccent