Tarantula
Tarantula

Reputation: 19843

Unaccent extension of Postgresql 9.1 returning empty row

I created the extension "unaccent" on the postgresql database but when I run a select using the "unaccent" it always return 1 row but with a blank line.

select ts_lexize('unaccent', 'Hôtel');
ts_lexize
-----------

(1 row)

Expected according to the documentation:

select ts_lexize('unaccent','Hôtel');
ts_lexize
-----------
{Hotel}
(1 row)

Also when I run:

SELECT unaccent('unaccent', 'Hôtel');

it shows:

unaccent
----------
Hôtel
(1 row)

Upvotes: 1

Views: 927

Answers (2)

Vinicius Lima
Vinicius Lima

Reputation: 544

It depends on Postgres editor or Operational System. Problably you're using MacOS or Linux to show the results. I agreed Tarantula. If you change encoding database to UTF-8, it will be much better.

Try to execute this select in a Postgres Windows editor. With me worked. The "blank" result appered.

Hgs =)

Upvotes: 0

Tarantula
Tarantula

Reputation: 19843

I just discovered that the problem was that the database encoding, which was using the SQL_ASCII encoding, so I dropped the database, recreated it with UTF-8 and then it started to worked fine. It seems that the unaccent doesn't work with SQL_ASCII.

Upvotes: 2

Related Questions