Change PostgreSQL Locale

Friday, January 21, 2011 posted by rafael

wrote by Rafael Marangoni, from Suporte Linux team.

This article explains how to change the default PostgreSQL Locale. Be careful, because we're considering that you do not have data on postgresql instance.

First, we need to stop the postgres service (if was not already stopped):

/etc/init.d/postgresql stop

Then we need to remove all data files from postgresql data dir. On RedHat based, that's the dir:

rm -rf /var/lib/pgsql/data/*

Now we change to postgres user:

su postgres

Creating the initial data, selecting the Locale:

initdb --locale=C /var/lib/pgsql/data

or

initdb --locale=pt_BR.UTF-8 /var/lib/pgsql/data

or your locale

/etc/init.d/postgresql stop

Then, we start postgres service:

/etc/init.d/postgresql start

Be Sociable, Share!



Leave a Reply