Agras Zeta Atino

Un blog mas de tecnologia, locuras y procrastinacion

Create a PostgreSQL database/cluster with a different encoding

This is a simple way to create a PostgreSQL database/instance with another encoding than your default’s (e.g.: EUC_JP instead of UTF-8).

in most debian-based distros (For example in ubuntu, and debian itself), you can simply use the following command to create (and afterwards run) a PostgreSQL database cluster with a an encoding other than default.

LC_ALL=C /usr/lib/postgresql/8.4/bin/initdb -E EUC_JP -D $(pwd)

After this, you will se a message telling you to start the database and stuff… and that’s it. You just have to be carefull when starting the database, since the command configures everthing to be working with the port 5432 which is postgresql’s default port. Also, you may have to set the permissons.

This also gives another advantage, have multiple databases with different encodings, as the regional configuration of the cluster is set to C. This link to the PostgreSQL’s official docs, explains why you have to do this kind of magic to be able to have something like this. Just an advice:

BE CAREFULL.

Facebook Twitter Email
Etiquetas: , ,

Tu dirección de correo no será publicada. Los campos obligatorios están marcados con *

*

Social links powered by Ecreative Internet Marketing