[OSM-dev] Problem in rake db:migrate with postgre

Andy Allan gravitystorm at gmail.com
Thu Jun 3 22:13:05 BST 2010


On Thu, Jun 3, 2010 at 6:26 PM, M Naveed Akram <cmnajs at gmail.com> wrote:
> i upgraded to 8.4
> very thanks.
> but there seems to be an issue with 8.4 for UTF8, it does not allow to
> create database with UTF8 Encoding.

Ah, I think I know this problem. It is very annoying.

When postgres is installed, it sets a number of configurations based
on your locale. I'm going to assume your running on linux, is that
correct? Check the ouput of "locale". Everything should end with a
.UTF-8, for example:

LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"

However, if yours don't end in .UTF-8, then postgres will install with
non-UTF8 locales in lots of configuration files, such as
/etc/postgresql/8.4/main/postgresql.conf , and won't let you create
UTF8 databases.

I find the easiest way to fix this is uninstall postgres, run
"update-locale LANG=en_GB.UTF-8" and reinstall postgres. Obviously you
can use any language you like, just make sure that the locale is fixed
before you install postgres.

Cheers,
Andy




More information about the dev mailing list