1

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)
didierc
  • 14,572
  • 3
  • 32
  • 52
Tarantula
  • 19,031
  • 12
  • 54
  • 71
  • 1
    I suppose you have the `.rules` file installed, right? – didierc Apr 04 '13 at 21:13
  • Yes, it's the default Ubuntu installation, it's located on /usr/share/postgresql/9.1/tsearch_data/unaccent.rules. If I change the dictionary 'unaccent' to another one, it says that the dict doens't exists, so it is using the right dictionary. – Tarantula Apr 05 '13 at 00:03
  • Ok, I was just checking the obvious, first. – didierc Apr 05 '13 at 00:17

2 Answers2

2

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.

Tarantula
  • 19,031
  • 12
  • 54
  • 71
  • Whoa... " It seems that the unaccent doesn't work with SQL_ASCII" is quite an statement.. i'm searching in the official docs of postgres and there is no clue about that.. – Victor Nov 24 '16 at 16:08
0

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 =)

Vinicius Lima
  • 534
  • 7
  • 20