markus
markus

Reputation: 6568

postgres - cannot create collation

I have a postgres 9.2 database running on debian wheezy. If I execute in pgadmin:

CREATE COLLATION en ( LOCALE = 'en_US.UTF-8')

I get the following error message.

ERROR:  could not create locale "en_US.UTF-8": Datei oder Verzeichnis nicht gefunden
DETAIL:  The operating system could not find any locale data for the locale name "en_US.UTF-8".

I already configured locals on that machine and restarted postgres:

locale-gen en_US.UTF-8
Generating locales (this might take a while)...
  de_DE.UTF-8... done
  en_US.UTF-8... done
  fr_FR.UTF-8... done
  tr_TR.UTF-8... done

But the error is still there. Is there anything else I need to check?

Upvotes: 3

Views: 2362

Answers (1)

Chris Travers
Chris Travers

Reputation: 26474

Your basic problem is that PostgreSQL uses operating system locales and collation orders.

On Debian, you need to run the following to add the locale:

dpkg-reconfigure locales

Then once en_US.UTF-8 is there it should work.

Upvotes: 1

Related Questions