unaccent

text search dictionary that removes accents

Overview

PackageVersionCategoryLicenseLanguage
unaccent1.1FUNCPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
4990unaccentNoYesNoYesYesNo-
Relatedpg_trgm fuzzystrmatch citext btree_gist btree_gin prefix dict_xsyn dict_int

Version

PG18PG17PG16PG15PG14
1.11.11.11.11.1

Install

Note: This is a built-in contrib extension of PostgreSQL

CREATE EXTENSION unaccent;

Usage

unaccent: text search dictionary for accent removal

Removes accents (diacritic signs) from text. Can be used as a text search dictionary or as a standalone function.

CREATE EXTENSION unaccent;

Functions

FunctionDescription
unaccent(text)Remove accents using the default dictionary
unaccent(dictionary regdictionary, text)Remove accents using a specific dictionary

Text Search Usage

-- Test the dictionary
SELECT ts_lexize('unaccent', 'Hôtel');
-- {Hotel}

-- Create an accent-insensitive French text search config
CREATE TEXT SEARCH CONFIGURATION fr (COPY = french);
ALTER TEXT SEARCH CONFIGURATION fr
  ALTER MAPPING FOR hword, hword_part, word
  WITH unaccent, french_stem;

SELECT to_tsvector('fr', 'Hôtels de la Mer');
-- 'hotel':1 'mer':4

-- Accent-insensitive search
SELECT to_tsvector('fr', 'Hôtel de la Mer') @@ to_tsquery('fr', 'Hotels');
-- true

Standalone Function Usage

SELECT unaccent('Hôtel');           -- Hotel
SELECT unaccent('café');            -- cafe
SELECT unaccent('résumé');          -- resume
SELECT unaccent('niño');            -- nino

Last Modified 2026-03-12: add pg extension catalog (95749bf)